List stored functions that reference a table in PostgreSQL

后端 未结 9 1065
深忆病人
深忆病人 2020-12-07 14:10

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

相关标签:
9条回答
  • 2020-12-07 14:57
    SELECT  proname, prosrc
    FROM    pg_catalog.pg_namespace n
    JOIN    pg_catalog.pg_proc p
    ON      pronamespace = n.oid
    WHERE   nspname = 'public';
    
    0 讨论(0)
  • 2020-12-07 14:59

    You can use the standard information_schema schema to get metadata about your database (it's in the SQL standard, so it should work the same way in different database systems). In this case you want information_schema.routines.

    0 讨论(0)
  • 2020-12-07 15:03

    For retrieving the argument types of the functions, which are required when referencing the function in ALTER -- using oldevectortypes worked well for me.

    See How can I get a list of all functions stored in the database of a particular schema in PostgreSQL?

    0 讨论(0)
提交回复
热议问题