-
-
Save dstrbad/cc7e3b3a05a80efc300d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT 'drop table '||n.nspname ||'.'|| c.relname||' CASCADE;' as "Name" | |
| FROM pg_catalog.pg_class c | |
| LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
| WHERE c.relkind IN ('r','v','S','') | |
| AND n.nspname = 'destination_schema'; | |
| SELECT 'create table '||n.nspname ||'.'|| c.relname||' as select * from source_schema.' || c.relname||';' as "Name" | |
| FROM pg_catalog.pg_class c | |
| LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
| WHERE c.relkind IN ('r','v','S','') | |
| AND n.nspname = 'destination_schema'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment