table of contents
- buster 11.9-0+deb10u1
CREATE FOREIGN DATA WRAPPER(7) | PostgreSQL 11.9 Documentation | CREATE FOREIGN DATA WRAPPER(7) |
NAME¶
CREATE_FOREIGN_DATA_WRAPPER - define a new foreign-data wrapperSYNOPSIS¶
CREATE FOREIGN DATA WRAPPER name [ HANDLER handler_function | NO HANDLER ] [ VALIDATOR validator_function | NO VALIDATOR ] [ OPTIONS ( option 'value' [, ... ] ) ]
DESCRIPTION¶
CREATE FOREIGN DATA WRAPPER creates a new foreign-data wrapper. The user who defines a foreign-data wrapper becomes its owner.The foreign-data wrapper name must be unique within the database.
Only superusers can create foreign-data wrappers.
PARAMETERS¶
nameHANDLER handler_function
It is possible to create a foreign-data wrapper with no handler function, but foreign tables using such a wrapper can only be declared, not accessed.
VALIDATOR validator_function
OPTIONS ( option 'value' [, ... ] )
NOTES¶
PostgreSQL's foreign-data functionality is still under active development. Optimization of queries is primitive (and mostly left to the wrapper, too). Thus, there is considerable room for future performance improvements.EXAMPLES¶
Create a useless foreign-data wrapper dummy:CREATE FOREIGN DATA WRAPPER dummy;
Create a foreign-data wrapper file with handler function file_fdw_handler:
CREATE FOREIGN DATA WRAPPER file HANDLER file_fdw_handler;
Create a foreign-data wrapper mywrapper with some options:
CREATE FOREIGN DATA WRAPPER mywrapper OPTIONS (debug 'true');
COMPATIBILITY¶
CREATE FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), with the exception that the HANDLER and VALIDATOR clauses are extensions and the standard clauses LIBRARY and LANGUAGE are not implemented in PostgreSQL.Note, however, that the SQL/MED functionality as a whole is not yet conforming.
SEE ALSO¶
ALTER FOREIGN DATA WRAPPER (ALTER_FOREIGN_DATA_WRAPPER(7)), DROP FOREIGN DATA WRAPPER (DROP_FOREIGN_DATA_WRAPPER(7)), CREATE SERVER (CREATE_SERVER(7)), CREATE USER MAPPING (CREATE_USER_MAPPING(7)), CREATE FOREIGN TABLE (CREATE_FOREIGN_TABLE(7))2020 | PostgreSQL 11.9 |