2

I have 3 separate ruby on rails applications running PostgreSQL databases, all with the same tables (and columns) but different values.

For example :

app 1 TABLE

name surname postcode
----------
tom  smith   so211ux

app 2 TABLE

name  surname postcode
----------
mark  smith   so2ddx

app 3 TABLE

name   surname   postcode
----------
james  roberts   F2D1ux

I am looking to export/dump/download from two of the databases and import into one consolidated database/app.

If someone could point me in the right direction/reading for this type of query I would be most grateful.

Mahesh H Viraktamath
  • 818
  • 3
  • 14
  • 34
Tom Collom
  • 37
  • 4

1 Answers1

0

Please use the foreign data wrappers (fdw), where you can access the data from external postgresql servers. Please read more here - https://www.postgresql.org/docs/9.3/static/postgres-fdw.html

Mahesh H Viraktamath
  • 818
  • 3
  • 14
  • 34
  • Thanks for the response. I have done some reading on this and i'm not sure this is the best solution. I will not need regular access to the other apps; just a one time dump and import. Would you still recommend FDW? – Tom Collom Oct 12 '18 at 12:37
  • Yes, because it is already an in-built extension, so it shouldn't take much time to accomplish the one-time import. It will be just a matter of single insert query. – Mahesh H Viraktamath Oct 12 '18 at 12:39