Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search text of all functions in PGAdmin

Using PostgreSQL with pgAdmin, and was wondering if there is a way to search ALL of the functions of a database for a particular text.

Is this possible?

like image 655
jlars62 Avatar asked Dec 02 '14 19:12

jlars62


People also ask

How do I find text in PostgreSQL function?

Text search by using to_tsvector function and operator We have search text by using the to_tsvector function in PostgreSQL. In to_tsvector, “ts” is defined as text search. In to_tsvector, the tsvector is the data type of to_tsvector function. This function will return the lexeme tokens with pointers in PostgreSQL.

How do I use full text search in PostgreSQL?

In PostgreSQL, you use two functions to perform Full Text Search. They are to_tsvector() and to_tsquery(). Let's see how they work and to use them first. to_tsvector() function breaks up the input string and creates tokens out of it, which is then used to perform Full Text Search using the to_tsquery() function.

How do I do a wildcard search in PostgreSQL?

Use ILIKE : SELECT * FROM table WHERE columnName ILIKE 'R%'; or a case-insensitive regular expression: SELECT * FROM table WHERE columnName ~* '^R.


2 Answers

Something like this should work:

select proname, prosrc from pg_proc where prosrc like '%search text%'; 

see How to display the function, procedure, triggers source code in postgresql?

like image 193
Andreas Avatar answered Sep 26 '22 14:09

Andreas


If schema info is required too (we work with many):

select     nspname,     proname,     prosrc  from pg_catalog.pg_proc pr join pg_catalog.pg_namespace ns on ns.oid = pr.pronamespace where prosrc ilike '%search text%' 
like image 42
steevee Avatar answered Sep 22 '22 14:09

steevee