mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Implement IMPORT FOREIGN SCHEMA.
This command provides an automated way to create foreign table definitions that match remote tables, thereby reducing tedium and chances for error. In this patch, we provide the necessary core-server infrastructure and implement the feature fully in the postgres_fdw foreign-data wrapper. Other wrappers will throw a "feature not supported" error until/unless they are updated. Ronan Dunklau and Michael Paquier, additional work by me
This commit is contained in:
@@ -1791,7 +1791,7 @@ typedef struct AlterForeignServerStmt
|
||||
} AlterForeignServerStmt;
|
||||
|
||||
/* ----------------------
|
||||
* Create FOREIGN TABLE Statements
|
||||
* Create FOREIGN TABLE Statement
|
||||
* ----------------------
|
||||
*/
|
||||
|
||||
@@ -1831,6 +1831,29 @@ typedef struct DropUserMappingStmt
|
||||
bool missing_ok; /* ignore missing mappings */
|
||||
} DropUserMappingStmt;
|
||||
|
||||
/* ----------------------
|
||||
* Import Foreign Schema Statement
|
||||
* ----------------------
|
||||
*/
|
||||
|
||||
typedef enum ImportForeignSchemaType
|
||||
{
|
||||
FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */
|
||||
FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */
|
||||
FDW_IMPORT_SCHEMA_EXCEPT /* exclude listed tables from import */
|
||||
} ImportForeignSchemaType;
|
||||
|
||||
typedef struct ImportForeignSchemaStmt
|
||||
{
|
||||
NodeTag type;
|
||||
char *server_name; /* FDW server name */
|
||||
char *remote_schema; /* remote schema name to query */
|
||||
char *local_schema; /* local schema to create objects in */
|
||||
ImportForeignSchemaType list_type; /* type of table list */
|
||||
List *table_list; /* List of RangeVar */
|
||||
List *options; /* list of options to pass to FDW */
|
||||
} ImportForeignSchemaStmt;
|
||||
|
||||
/* ----------------------
|
||||
* Create TRIGGER Statement
|
||||
* ----------------------
|
||||
|
||||
Reference in New Issue
Block a user