• support[@]kurinchilion.com
  • +1 (888) 666-4252

Tags

PostgreSQL: How to drop a schema and all the tables inside it before restoring database?

Dec 14, 2022 - by kurinchilamp / / Post Comment
When we come across scenarios whereby we have to drop all the tables in a database before a restore, the following commands come in handy. DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO public; To manually drop all tables in a database we select 'DROP TABLE "' || tablename || '" cascade;' from pg_tables; To check if a table exist and then to drop it if it does select 'DROP TABLE IF EXISTS "' || tablename || '" cascade;' from pg_tables;
Continue Reading

TECHNOLOGY DEV STACK

Following are some of the technologies that we use to build and maintain solutions for our clients.