Answer the question
In order to leave comments, you need to log in
Full Postgres schema cloning?
When using pg_dump / pg_restore, as far as I understand, in any case, you have to rename the original schema twice (first add some prefix / postfix, then restore the dump, then rename the dump, and then remove the prefix from the original one). This option doesn't work for me.
I looked at the scripts on gist.github.com - some of them do not copy the data, but expand the schema quite quickly, others that should copy the data do not work, for example this and this one due to max_value.
Are there any other options?
Answer the question
In order to leave comments, you need to log in
If you dump in plaintext format (--format=p), the resulting file can be edited and added to the beginning
create schema new_schema;
set search_path to new_schema;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question