建立外部表
--安装postgres_fdw
CREATE EXTENSION postgres_fdw
--新建远程数据库
create server masterdb foreign data wrapper postgres_fdw options (host localhost,dbname MasterDB,port 5432) ;
--新建用户
create user mapping FOR postgres server masterdb options (user postgres,password sa) ;
--建立外部表
CREATE FOREIGN TABLE branches
(branchcd integer ,
branchname character varying(64) ,
branchtype integer NOT NULL)
SERVER masterdb;