我想从我的 Postgres 数据库中的所有模式中删除一个函数。我有大约 200 个模式,(t0000001
、t0000002
、t0000003
...)我真的不想手动完成。
有什么办法吗?
最佳答案
你可以试试这个:
do $$
declare s record;
begin
for s in select schema_name from information_schema.schemata loop
execute 'drop function if exists ' || s.schema_name || '.yourfunctionname()';
end loop;
end; $$;
关于sql - 如何从所有模式中删除函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29412131/