参考
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');
文档信息
- 本文作者:fei
- 本文链接:https://ayee1616166.github.io/2016/11/03/PostgreSQL%E4%B9%8BDBLINK/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)