This one is somehow a followup on "Duplicate row in plain sql". What I needed in this case was to copy
Both dbs live in the same physical postgres, and the main user has rights over everything, so the process was painless, and took 5 minutes to set it up (accounting for reading the docs).
The trick is to use the postgres_fdw and create a schema "dev" inside db_test, so I can access the tables in db_dev.
This file contains 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
create extension postgres_fdw ; | |
create server dev foreign data wrapper postgres_fdw options (host 'localhost', dbname 'db_dev'); | |
select user; | |
create user mapping for my_user server dev options (user 'my_user' ); | |
create schema dev; | |
import foreign schema public limit to ( table_to_copy ) from server dev into dev; | |
select * from dev.table_to_copy; |
No hay comentarios:
Publicar un comentario