使用工具 Navicat Premium 12
- create extension postgres_fdw;
- create server smp_fdw
- foreign data wrapper postgres_fdw
- options (host ‘10.0.0.4’,dbname ‘SMP’, port ‘5432’, instanceid ‘postgres-k0pfmwks’);
postgres-k0pfmwks 为数据库实例ID
- create user mapping for PUBLIC server smp_fdw options (user ‘root’,password ‘xxxxxx’);
- create foreign table shop(“id” varchar(32),
- “code” varchar(20),
- “name” varchar(50),
- “companyId” varchar(32),
- “address” varchar(200),
- “delFlag” int2,
- “createDate” timestamp(6),
- “createPerson” varchar(50),
- “editDate” timestamp(6),
- “editPerson” varchar(50)
- )
- server smp_fdw options(table_name ‘shop’);
参照文档:
本文链接地址: 腾讯云PSQL数据库外部表使用