- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2017-05-07T22:50:54+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 app1
OPTIONS (user 'postgres', password '');
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