更新时间:2022-11-24 14:44:21
尝试在 google [ ^ ]发布之前这个?
要在远程数据库中执行查询,可以使用 dblink [ ^ ]
Have tried searching this in google[^] prior to post here?
To execute a query in remote database you can use dblink[^]
insert into mytable
select *
from dblink('dbname=postgres hostaddr=xxx.xxx.xxx.xxx dbname=mydb user=postgres',
'select a,b from mytable')
as t1(a text,b text);
或者,您也可以使用 pg_dump 来做到这一点。
Or, you can also use pg_dump to do that.
pg_dump -t table_to_copy source_db | psql target_db
参考:
将表从一个数据库复制到Postgres中的另一个数据库 [ ^ ]
希望,它有帮助:)
Reference:
Copy a table from one database to another in Postgres[^]
Hope, it helps :)