Skip to content
Snippets Groups Projects
Select Git revision
  • 0422d24fdc93321cdff4e9be4cc3f48c22639dc0
  • devel default
  • master
  • fo
  • jirka/typing
  • fo-base
  • mj/submit-images
  • jk/issue-96
  • jk/issue-196
  • honza/add-contestant
  • honza/mr7
  • honza/mrf
  • honza/mrd
  • honza/mra
  • honza/mr6
  • honza/submit-images
  • honza/kolo-vs-soutez
  • jh-stress-test-wip
  • shorten-schools
19 results

drop-all.sql

Blame
  • drop-all.sql 446 B
    -- Delete all tables and types
    
    SET ROLE mo_osmo;
    
    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 $$;