May 2018
Intermediate to advanced
576 pages
30h 25m
English
Another-and sometimes easier-way of accessing other databases is with a tool named PL/Proxy, available as a PostgreSQL extension. PL/Proxy allows you to create a local database function that is a proxy for a remote database function. PL/Proxy works only for functions, and some people regard this as a restriction, in a way similar to postgres_fdw, which operates only on rows in tables. That is why these solutions complement dblink, rather than replacing it.
Creating a local proxy function is simple:
CREATE FUNCTION my_task(VOID)RETURNS SETOF text AS $$ CONNECT 'dbname=myremoteserver'; SELECT my_task();$$ LANGUAGE plproxy;
You need a local function, but you don't need to call a remote function; you can use SQL statements directly. ...