することができます答えは実際にはなく、ここで開始することではありません。
with obj_list as (
select
case when p.oid is not null then 'p' when t.oid is not null then 't' end as tp,
case when p.oid is not null then p.oid::regprocedure::text when t.oid is not null then t.typname end as def,
d.objid
from pg_depend d left join pg_proc p on (d.objid = p.oid) left join pg_type t on (d.objid = t.oid)
where refobjid = (select oid from pg_extension where extname = 'tablefunc' /* extension name here */))
select
case tp when 't' then 'drop type ' when 'p' then 'drop function ' end || 'public.' || def || ';' as drop_stmt
from obj_list
order by objid desc /* reverse object creation order to saticfy dependencies */;
出力:
┌──────────────────────────────────────────────────────────────────────────────┐
│ drop_stmt │
╞══════════════════════════════════════════════════════════════════════════════╡
│ drop function public.connectby(text,text,text,text,text,integer); │
│ drop function public.connectby(text,text,text,text,text,integer,text); │
│ drop function public.connectby(text,text,text,text,integer); │
│ drop function public.connectby(text,text,text,text,integer,text); │
│ drop function public.crosstab(text,text); │
│ drop function public.crosstab(text,integer); │
│ drop function public.crosstab4(text); │
│ drop function public.crosstab3(text); │
│ drop function public.crosstab2(text); │
│ drop type public.tablefunc_crosstab_4; │
│ drop type public.tablefunc_crosstab_3; │
│ drop type public.tablefunc_crosstab_2; │
│ drop function public.crosstab(text); │
│ drop function public.normal_rand(integer,double precision,double precision); │
└──────────────────────────────────────────────────────────────────────────────┘
一つの小さな質問:どのようにあなたが延長のいくつかのコピーを作成しましたか? Newerはこれまでに試しましたが、別のスキーマで既存の拡張を作成しようとすると、PostgreSQLは次のように言っています: "ERROR:extension" tablefunc "already exists" – Abelisto