DO $$ DECLARE
    r RECORD;
BEGIN
    -- if the schema you operate on is not"current", you will want to
    -- replace current_schema() in query with 'schematodeletetablesfrom'
    -- *and* update the generate 'DROP...' accordingly.
    FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP
        EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
    END LOOP;
END $$;

连接进入数据库,执行上述存储过程语句

相关文章:

  • 2021-10-12
  • 2021-11-30
  • 2021-08-17
  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2021-11-30
  • 2022-01-13
  • 2021-09-08
  • 2021-10-16
  • 2021-09-25
  • 2021-08-18
  • 2021-07-24
相关资源
相似解决方案