Migrate tables from one PostgreSQL database to another using the INFORMATION_SCHEMA
Recently a client asked us to create a database migration process between two PostgreSQL databases. This would have been a very trivial process, but for the following restriction…
We didn’t have access to the source database and the client could not provide us with the schema due to their strict data management policy.
So in essence we had to create a script that would migrate a list of tables, schema and data, from one database to another without having to specify the exact schema for each table.