时间:2021-07-01 10:21:17 帮助过:29人阅读
---加载扩展
create extension postgres_fdw;
---创建远程数据库 server_remote_yzt2000db hostaddr为 ‘172.18.4.35‘port 为 ‘5432‘ dbname 为 ‘yzt2000db‘
create server server_remote_yzt2000db foreign data wrapper postgres_fdw options (hostaddr ‘172.18.4.35‘, port ‘5432‘, dbname ‘yzt2000db‘);
---为用户 smapadmin创建 server_remote_yzt2000db的登录信息
create user mapping for smapadmin server server_remote_yzt2000db options (user ‘smapadmin‘, password ‘clric@smap_2019‘);
---通过 server_remote_yzt2000db 创建 yzt2000db.public.jc_ch_dem_500_pg的投影到 当前db的public
import FOREIGN SCHEMA public limit to ( jc_ch_dem_500_pg ) from server server_remote_yzt2000db INTO public
--删除投影
drop FOREIGN table jc_ch_dem_500_pg
postgresql 创建远程表投影
标签:imp pad 创建 remote extension 加载 mapping 登录 pass