在Oracle SQL中,我经常使用ALL_SURCE表,例如:
select * from all_source where upper(text) like upper('%some_code_line%');
Postgres中是否有与此select语句等效的内容?
答案 0 :(得分:2)
函数(或过程)的源存储在pg_proc.prosrc
中,因此以下内容类似:
select proname
from pg_proc
where upper(prosrc) like upper('%some_code_line%');
如果需要,可以使用and prokind in ('f', 'p')
答案 1 :(得分:1)
您将使用以下查询在postgresql中获得所有函数的详细信息,
SELECT *
FROM information_schema.routines;
如果希望使用所有软件包,则在postgresql中,以下链接中列出了多个表,请充分利用
答案 2 :(得分:0)
我能够创建与Oracle的all_source非常相似的视图:
create or replace view all_source as
select
proowner::regrole as owner,
proname AS name,
regexp_split_to_table(prosrc, E'\\n+') as text
from pg_proc
order by name;
然后我只需要这样做:
select * from all_source
where upper(text) like upper('%some_code_line%');