#author("2017-05-08T19:19:48+09:00","","")
#contents

* postgres_fdw [#qb7f61e5]

- Foreign Data Wrapperのpostgres実装の1つ。
- PostgresSQLデータベースから,別のPostgresSQLデータベースのテーブルにアクセスすることができる。


* 設定・使用方法 [#c92ed723]

#geshi(sql){{
CREATE EXTENSION postgres_fdw;
CREATE SERVER postgres_server FOREIGN DATA WRAPPER postgres_fdw
    OPTIONS (host 'localhost', dbname 'test', port '5434');

CREATE USER MAPPING FOR public SERVER postgres_server
OPTIONS (user 'postgres', password 'testuser');

CREATE FOREIGN TABLE fs_warehouse (
     id int,
     name text
) SERVER postgres_server
OPTIONS (table_name 'fs_warehouse');

SELECT * FROM fs_warehouse;

-- DROP FOREIGN TABLE fs_warehouse;
-- DROP USER MAPPING FOR public SERVER postgres_server;
-- DROP SERVER postgres_server CASCADE;
}}

* 参考リンク [#n6d6d7f8]

- https://www.postgresql.jp/document/9.6/html/postgres-fdw.html
- https://www.postgresql.org/docs/9.5/static/postgres-fdw.html


トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
目次
ダブルクリックで閉じるTOP | 閉じる
GO TO TOP