Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database 如何在postgreSQL中获取自定义函数注释_Database_Postgresql - Fatal编程技术网

Database 如何在postgreSQL中获取自定义函数注释

Database 如何在postgreSQL中获取自定义函数注释,database,postgresql,Database,Postgresql,我正在尝试获取我在程序中保存所需基本信息的函数注释。我创建了许多函数,所有函数的名称都以“stat_u2;”开头,我正在使用下面的代码检索它们的名称 SELECT routines.routine_name FROM information_schema.routines LEFT JOIN information_schema.parameters ON routines.specific_name=parameters.specific_name WHERE routines.specif

我正在尝试获取我在程序中保存所需基本信息的函数注释。我创建了许多函数,所有函数的名称都以“stat_u2;”开头,我正在使用下面的代码检索它们的名称

SELECT routines.routine_name
FROM information_schema.routines
LEFT JOIN information_schema.parameters ON 
routines.specific_name=parameters.specific_name
WHERE routines.specific_schema='public' AND routines.routine_name LIKE 
'stat_%' ORDER BY routines.routine_name, parameters.ordinal_position;
现在我有了所有的函数名,我需要得到它们的注释。
我找不到解决方案,如果您知道,请共享。

可以通过对象id通过
pgu description
检索注释

SELECT p.proname,
       p.proargtypes,
       d.description
       FROM pg_proc p
            LEFT JOIN pg_description d
                      ON d.objoid = p.oid
       WHERE p.proname LIKE 'stat$_%' ESCAPE '$';
然后,您可以通过以下命令获取对象的源:

EXEC sp_helptext 'ObjectName';

什么是pg_proc?@CodeMan:函数的目录表。
EXEC sp_helptext 'ObjectName';