[SQL DRIVEN] GetExistingLocalJoinPath

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;

posted on 2024-05-29 20:03  winter-loo  阅读(1)  评论(0编辑  收藏  举报

导航