Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pull up a list of user added functions 1

Status
Not open for further replies.

thewhistler1

Technical User
Jan 20, 2008
35
US
Hello

I am trying to bring up a list of user added functions. I know that \df is supposed to bring up functions but I don't see the ones I added, even if I do a \df *.

Any ideas on how I could do this.
 
Hi

Interesting. [tt]\df[/tt] always returned the full list to me, including "user added functions" too.

Then try [tt]\dS[/tt] for a list of system tables and views. There you will find the name of the [tt]pg_proc[/tt] table. So for a bare list of stored procedure names :
Code:
[b]select[/b] proname [b]from[/b] pg_proc [b]where[/b] proowner!=1;

Feherke.
 
Thanks for the tip, after I wrote this I noticed that the user added functions are there but they are all the way at the bottom. The pg_catalog ones are first in alphabetical order then comes the user added functions in alphabetical order. I assumed since it was alphabetical that the one I was looking for one be in the U's, but I was looking in the wrong set of U's. It would be nice though to bring a list of only user added functions so you wouldn't have to scroll all the way to the bottom before getting to the ones that you are looking for. If anyone knows of a way to do that I would be happy to hear it. Thanks
 
Hi

I see my above [tt]select[/tt] worked well only on PostgreSQL 7.3. This version will work on 8.2 too, listing only the names of stored procedures :
Code:
[b]select[/b] p.proname [b]from[/b] pg_proc p [b]inner[/b] [b]join[/b] pg_user u [b]on[/b] u.usesysid=p.proowner [b]where[/b] u.usename!=[i]'postgres'[/i];

Feherke.
 
That gives me a list of everything just like the other but what would really be helpful is something that gives me just the ones that were added AND give me the details of the function, like how it is set up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top