postgres_fdw 使用

--创建扩展连接

create extension postgres_fdw;

--创建本地服务器连接外部服务器

create serverserver_remote_13foreign data wrapperpostgres_fdwoptions(host'192.168.11.13',port'5432',dbname'party');

--创建用户映射

create user mapping forpostgresserverserver_remote_13options(user'party',password'party');

--本地创建外部表,指定server

CREATE FOREIGN TABLEparty(

party_idvarchar(256),

party_type_idvarchar(256),

external_idvarchar(256),

preferred_currency_uom_idvarchar(256),

descriptiontext,

status_idvarchar(256),

created_datetimestamp with time zone,

created_by_user_loginvarchar(255),

last_modified_datetimestamp with time zone,

last_modified_by_user_loginvarchar(255),

data_source_idvarchar(256),

is_unreadchar,

last_updated_stamptimestamp with time zone,

last_updated_tx_stamptimestamp with time zone,

created_stamptimestamp with time zone,

created_tx_stamptimestamp with time zone)

serverserver_remote_13options(schema_name'public',table_name'party');


参考文章:my.oschina.net/Kenyon/blog/214953

你可能感兴趣的:(postgres_fdw 使用)