Answers for "how to drop all tables in postgresql"

SQL
7

how to remove tables from postgresql

DROP TABLE IF EXISTS tablename;
Posted by: Guest on August-27-2020
3

force drop all tables postgres

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
Posted by: Guest on November-26-2020
0

how to drop all tables in postgresql

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;

GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
Posted by: Guest on August-03-2021
0

postgres drop all tables

DO $$ 
  DECLARE 
    r RECORD;
BEGIN
  FOR r IN 
    (
      SELECT table_name 
      FROM information_schema.tables 
      WHERE table_schema=current_schema()
    ) 
  LOOP
     EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.table_name) || ' CASCADE';
  END LOOP;
END $$ ;
Posted by: Guest on September-08-2021

Code answers related to "how to drop all tables in postgresql"

Code answers related to "SQL"

Browse Popular Code Answers by Language