My goal is to create a temporary
schema, fill it from big data then drop my public
schema and rename the temporary
schema to public
, in order to reduce the time the database is unavailable.
How to duplicate schema structure into temporary
schema?
CodePudding user response:
I never dropped public schema, but:
pg_dump --schema-only --schema=public | set '%s/public\./temporary\./g' | psql -h samehost
DROP SCHEMA public;
ALTER SCHEMA temporary RENAME TO public;