如何在Postgres上删除多个架构

时间:2018-12-27 06:43:29

标签: postgresql schema

DROP SCHEMA a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z

我在查询上方运行时,我得到了

ERROR:  out of shared memory
HINT:  You might need to increase max_locks_per_transaction.

我还有其他方法可以在postgres中删除多个模式。

2 个答案:

答案 0 :(得分:0)

尝试drop schema <schemaname> cascade。 这样,您一次只能删除一个架构。 希望对您有所帮助。

答案 1 :(得分:0)

在每次DROP SCHEMA之后尝试COMMIT完成事务

DROP SCHEMA a; COMMIT;
DROP SCHEMA b; COMMIT;
DROP SCHEMA c; COMMIT;
DROP SCHEMA d; COMMIT;
DROP SCHEMA e; COMMIT;
DROP SCHEMA f; COMMIT;
DROP SCHEMA g; COMMIT;
DROP SCHEMA h; COMMIT;
DROP SCHEMA i; COMMIT;
DROP SCHEMA j; COMMIT;
DROP SCHEMA k; COMMIT;
DROP SCHEMA l; COMMIT;
DROP SCHEMA m; COMMIT;
DROP SCHEMA n; COMMIT;
DROP SCHEMA o; COMMIT;
DROP SCHEMA p; COMMIT;
DROP SCHEMA q; COMMIT;
DROP SCHEMA r; COMMIT;
DROP SCHEMA s; COMMIT;
DROP SCHEMA t; COMMIT;
DROP SCHEMA u; COMMIT;
DROP SCHEMA v; COMMIT;
DROP SCHEMA w; COMMIT;
DROP SCHEMA x; COMMIT;
DROP SCHEMA y; COMMIT;
DROP SCHEMA z; COMMIT;