A foreign data wrapper for connecting PostgreSQL databases

postgres_fdw is a foreign data wrapper provided as a contrib module for connecting PostgreSQL databases.

postgres_fdw was added in PostgreSQL 9.3.

Source code

postgres_fdw source is located at contrib/postgres_fdw/.

Change history

  • PostgreSQL 15
    • support for parallel commit added (commit 04e706d4)
    • CASE expressions can be pushed to the remote server (commit 5d44fff0)
    • remote connection's application_name can be set via GUC postgres_fdw.application_name (commit 449ab635)
    • postgres_fdw.application_name can include certain escape sequences (commits 6e0cb3de and 94c49d53)
    • report warning when timeout expiration occurs while retrieving a query result (commit 815d61fc)
  • PostgreSQL 14
    • support for bulk inserts; server/table-level option batch_size (commit b663a413)
    • function postgres_fdw_get_connections() added (commit 708d165d)
    • function postgres_fdw_disconnect() added (commit 411ae649)
    • function postgres_fdw_disconnect_all() added (commit 411ae649)
    • table/server option async_capable added to enable asynchronous execution support (commit 27e1f145)
    • server option keep_connections added (commit b1be3074)
    • partitions specified in the IMPORT FOREIGN SCHEMA ... LIMIT clause can now be imported (commit a3740c48)
    • support for truncating foreign tables added (commit 8ff1c946)
  • PostgreSQL 13
    • options sslkey and sslcert added at server and user mapping level to enable different users to authenticate with different certificates (commit f5fd995a)
    • passwordless non-superuser connections permitted, mainly to facilitate passwordless SSL authentication (commit 6136e94d)
  • PostgreSQL 12
    • expand the number of cases where ORDER BY sorts and LIMIT clauses can be pushed to remote servers (commits d50d172e and ffab494a)
    • Improve optimizer cost accounting for postgres_fdw queries (commits 08d2d58a, 8b6da83d and edbcbe27)
    • Properly honour WITH CHECK OPTION on views that reference postgres_fdw tables (a45adc74)
  • PostgreSQL 11
    • support for pushing down partition-level aggregates to partitioned tables added (commit 7e0d64c7)
    • support for pushing UPDATEs and DELETEs using joins to foreign tables added (commit 1bc0100d)
    • support for COPY and foreign partition routing added (commit 3d956d95)
  • PostgreSQL 10
    • aggregate functions can be pushed to the remote server (commit 7012b132)
    • additional types of join can be pushed to the remote server (commits b30fb56b and 332bec1e)
    • OID columns will now be fetched from the remote server (commits ae025a15)
  • PostgreSQL 9.6
    • basic support added for remote joins (commits e4106b25 and aa09cd24)
    • support added for remote sorts (commits f18c944b and ccd8f979)
    • support added for directly modifying foreign tables with remote UPDATEs, and DELETEs (commit 0bf3ae88)
    • the fetch_size option can now be applied to individual tables as well as the foreign server (commit dc203dc3)
    • query cancellation requests will be transmitted to the remote server (commits f039eaac and 1b812afb)
    • user mappings which map to the same user on the remote server will be consolidated into a single remote connection (commit 96198d94)
    • extension functions and operators, if specified in the extensions option, can be pushed down to the remove server (commit d8949416)
  • PostgreSQL 9.4
    • extended pushdown of VARCHAR columns through improved handling of collation-related decisions (commit 76f965ff)
  • PostgreSQL 9.3


For an example of a postgres_fdw setup, see the entry "foreign table".


Contrib module, Data import/export, Foreign Data Wrapper (FDW)

See also

dblink, file_fdw