Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List stored functions that reference a table in PostgreSQL

Just a quick and simple question: in PostgreSQL, how do you list the names of all stored functions/stored procedures using a table using just a SELECT statement, if possible? If a simple SELECT is insufficient, I can make do with a stored function.

My question, I think, is somewhat similar to this other question, but this other question is for SQL Server 2005:
List of Stored Procedure from Table

(optional) For that matter, how do you also list the triggers and constraints that use the same table in the same manner?

like image 887
Paolo B. Avatar asked Oct 13 '09 08:10

Paolo B.


People also ask

What is reference table in PostgreSQL?

A foreign key is a column or a group of columns in a table that reference the primary key of another table. The table that contains the foreign key is called the referencing table or child table. And the table referenced by the foreign key is called the referenced table or parent table.

What is stored function in PostgreSQL?

A PostgreSQL function or a stored procedure is a set of SQL and procedural commands such as declarations, assignments, loops, flow-of-control etc. stored on the database server and can be involved using the SQL interface. And it is also known as PostgreSQL stored procedures.


1 Answers

SELECT  p.proname FROM    pg_catalog.pg_namespace n JOIN    pg_catalog.pg_proc p ON      p.pronamespace = n.oid WHERE   n.nspname = 'public'; 
like image 101
Quassnoi Avatar answered Sep 26 '22 02:09

Quassnoi