O'Reilly logo

Mastering PostgreSQL 10 by Hans-Jurgen Schonig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting to remote servers using postgres_fdw

Data is not always in one location only. More often than not, data is spread all over the infrastructure and it can be that data residing in various places which has to be integrated.

The solution to the problem is a foreign data wrapper, as defined by the SQL/MED standard.

In this section, the postgres_fdw extension will be discussed. It is a module that allows you to dynamically fetch data from a PostgreSQL data source. The first thing is to deploy the foreign data wrapper:

test=# \h CREATE FOREIGN DATA WRAPPER Command: CREATE FOREIGN DATA WRAPPERDescription: define a new foreign-data wrapperSyntax:CREATE FOREIGN DATA WRAPPER name[ HANDLER handler_function | NO HANDLER ][ VALIDATOR validator_function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required