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

后端 未结 8 616
别那么骄傲
别那么骄傲 2020-12-04 05:59

How to print functions and triggers sourcecode in postgresql? please let me know if any one know the query to display the function, triggers source code.

8条回答
  •  萌比男神i
    2020-12-04 06:19

    There are many possibilities. Simplest way is to just use pgAdmin and get this from SQL window. However if you want to get this programmatically then examinate pg_proc and pg_trigger system catalogs or routines and triggers views from information schema (that's SQL standard way, but it might not cover all features especially PostgreSQL-specific). For example:

    SELECT
        routine_definition 
    FROM
        information_schema.routines 
    WHERE
        specific_schema LIKE 'public'
        AND routine_name LIKE 'functionName';
    

提交回复
热议问题