Skip to content
Snippets Groups Projects
Select Git revision
  • 87bbc07193834634fe50dd287d80a042de91b3a6
  • master default protected
2 results

splay_operation_test.py

Blame
  • drop-all.sql 448 B
    -- 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 $$;