PostgreSQL之DBLINK

2016/11/03 PostgreSQL 共 417 字,约 2 分钟

参考

dblink-connect
dblink-disconnect

实例

1.连接其他库

select dblink_connect('myconn','hostaddr=10.0.227.73 port=5432 dbname=pointer user=pointer password=pointer');

 

2.建立视图

CREATE VIEW tt AS
SELECT *
    FROM dblink('myconn', 'select datadate from test')
    AS t1(S              bigint);

 

3.获取dblink的名称

select dblink_get_connections();

--展示如下:
DB=# select dblink_get_connections();
  dblink_get_connections
--------------------------
 {myconn}

4.断开连接

SELECT dblink_disconnect('myconn');

文档信息

Search

    Table of Contents