Skip to content
Snippets Groups Projects
Commit 3b5a39f3 authored by Martin Mareš's avatar Martin Mareš
Browse files

DB: Skript na smazání všech tabulek a typů

parent 87d95bb3
No related branches found
No related tags found
No related merge requests found
-- Delete all tables and types
SET ROLE mo_submit;
DO $$ DECLARE
r RECORD;
BEGIN
FOR r IN (SELECT tablename FROM pg_tables WHERE tableowner=current_user) LOOP
EXECUTE 'DROP TABLE ' || quote_ident(r.tablename) || ' CASCADE';
END LOOP;
FOR r IN (SELECT * FROM pg_type WHERE typcategory='E' AND typowner=(SELECT oid FROM pg_roles WHERE rolname=current_user)) LOOP
EXECUTE 'DROP TYPE ' || quote_ident(r.typname);
END LOOP;
END $$;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment