在postgres中使用本地选择进行远程插入 [英] remote insert using local select in postgres

查看:75
本文介绍了在postgres中使用本地选择进行远程插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地服务器上有一个具有表t1的数据库,在远程服务器上有一个具有表t2和t3的数据库。我想在本地数据库上创建一个函数,该函数可以使用本地数据在远程服务器上插入数据。

I have one database with table t1 at local server and one database with table t2 and t3 at remote server. I would like to create a function on local database that can insert data on remote server using local data.

示例:
本地表-t1(xid,newxid )

Example: local table - t1 (xid, newxid)

远程表-t2(id,xid,iname)

remote table - t2 (id, xid, iname)

要填充的远程表:
t3(t2.id,t1.newxid,t2.iname)

remote table to be populate: t3 (t2.id, t1.newxid, t2.iname)

条件:t1.xid = t2.xid

criteria: t1.xid = t2.xid

我了解dblink,但不确定如何专门用于上述要求。

I know about dblink, but not sure how to use it specifically for above requirements.

注意:我知道如何使用远程选择进行本地插入。

Note: I know how to do local insert with remote select.

任何帮助将不胜感激。 / p>

Any help would be appreciated.

推荐答案

您有两个选择:

可写外国数据包装器

这篇关于在postgres中使用本地选择进行远程插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆