允许 test 账号访问 demo 库
GRANT CONNECT ON DATABASE test TO demo;
禁止 test 账户访问所有public库
REVOKE ALL ON DATABASE test FROM PUBLIC;
同时截断表
BEGIN;
TRUNCATE TABLE "Table1" CASCADE;
TRUNCATE TABLE "Table2" CASCADE;
TRUNCATE TABLE "Table3" CASCADE;
COMMIT;
GRANT CONNECT ON DATABASE test TO demo;
REVOKE ALL ON DATABASE test FROM PUBLIC;
BEGIN;
TRUNCATE TABLE "Table1" CASCADE;
TRUNCATE TABLE "Table2" CASCADE;
TRUNCATE TABLE "Table3" CASCADE;
COMMIT;