postgresql 创建远程表投影
---加载扩展
create extension postgres_fdw;
---创建远程数据库 server_remote_yzt2000db hostaddr为 '*****'port 为 '5432' dbname 为 '*****'
create server server_remote_yzt2000db foreign data wrapper postgres_fdw options (hostaddr '*****', port '5432', dbname '*****');
---为用户 smapadmin创建 server_remote_yzt2000db的登录信息
create user mapping for smapadmin server server_remote_yzt2000db options (user '*****', password '*****');
---通过 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