Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.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
PostgreSQL:如何列出访问特定表的所有存储函数_Sql_Postgresql - Fatal编程技术网

PostgreSQL:如何列出访问特定表的所有存储函数

PostgreSQL:如何列出访问特定表的所有存储函数,sql,postgresql,Sql,Postgresql,对于给定的表,如何查找使用该表中任何字段的所有函数? 假设我有一个带(studentid,studentname)的学生表 我想要一个使用studentid和studentname的所有函数和触发器的列表 我的问题与类似,但给出的代码不起作用n.nspname是在与模式相关而不是与表相关的条件下给出的。可能不是很精确,但此查询应该可以工作 SELECT routine_schema, routine_name FROM information_schema.routines WHERE ro

对于给定的表,如何查找使用该表中任何字段的所有函数? 假设我有一个带(studentid,studentname)的学生表

我想要一个使用studentid和studentname的所有函数和触发器的列表


我的问题与类似,但给出的代码不起作用
n.nspname
是在与模式相关而不是与表相关的条件下给出的。

可能不是很精确,但此查询应该可以工作

SELECT routine_schema, routine_name 
FROM information_schema.routines 
WHERE routine_definition ~ 'student' 
AND routine_definition ~ 'studentid' 
AND routine_definition ~ 'studentname';
根据编写过程的方式,可以应用更精确的正则表达式。在示例中,如果您总是以以下形式编写表和列:
table.column
,您可以使用以下表达式:

... WHERE routine_definition ~ 'student\.studentid' 
AND routine_definition ~ 'student\.studentname'

表名在prosrc列中,必须使用like或regex查询该列。这与函数所在的架构无关。表有列,而不是字段。。。顺便说一句,信息模式。常规表格使用情况?id jarlh呢?@jarlh postgresql没有
信息模式。常规表格使用情况
@RadekPostołowicz,我明白了。感谢您提供的信息。由于sql和plpgsql不区分大小写,因此明智的做法是使用不区分大小写的运算符
~*
进行搜索。另外,请记住,函数可以依赖于使用动态执行sql的表,如果没有人工检查,可能很难识别。