Skip to content
Advertisement

PostgreSQL copy/transfer data from one database to another

I need to copy data from one table to another. the two tables have almost the same structure, but are in different databases.

i tried

wenn i try this, i get error cross database … not implemented

Advertisement

Answer

This is a really straightforward task. Just use dblink for this purpose:

If you need to fetch data from external database on a regular basis, it would be wise to define a server and user mapping. Then, you could use shorter statement:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement