The following sql statements will trigger calling function GetExistingLocalJoinPath
.
setup
CREATE EXTENSION postgres_fdw;
CREATE SERVER foreign_server
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host '127.0.0.1', dbname 'postgres', port '5433');
CREATE USER MAPPING FOR ldd
SERVER foreign_server
OPTIONS (user 'lightdb', password '');
CREATE FOREIGN TABLE local_table (
a int,
b text
)
SERVER foreign_server
OPTIONS (table_name 'remote_table');
CREATE FOREIGN TABLE local_table2 (
a int,
b text
)
SERVER foreign_server
OPTIONS (table_name 'remote_table2');
-- You need create two tables 'remote_table' and 'remote_table2' on the remote server
SELECT * FROM local_table;
triggering sql
UPDATE local_table
SET a = lt2.a + 1
FROM local_table lt join local_table2 lt2 on lt.a = lt2.a
WHERE lt.a = 3;
标签:remote,CREATE,SQL,server,DRIVEN,table,GetExistingLocalJoinPath,foreign,local
From: https://www.cnblogs.com/lddcool/p/18220968