Deepak Kumar
Deepak Kumar

Reputation: 159

How to drop multiple schema on postgres

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

When i am running above query, i am getting

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

I there any other way to drop multiple schemas in postgres.

Upvotes: 1

Views: 3228

Answers (2)

Sergey Gershkovich
Sergey Gershkovich

Reputation: 422

try COMMIT to complete the transaction after each DROP SCHEMA

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;

Upvotes: 0

Anjana
Anjana

Reputation: 883

Try drop schema <schemaname> cascade . With this, you can delete only one schema at a time though. Hope it helps.

Upvotes: 2

Related Questions