mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +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:
@@ -3567,6 +3567,21 @@ _copyCreateForeignTableStmt(const CreateForeignTableStmt *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static ImportForeignSchemaStmt *
|
||||
_copyImportForeignSchemaStmt(const ImportForeignSchemaStmt *from)
|
||||
{
|
||||
ImportForeignSchemaStmt *newnode = makeNode(ImportForeignSchemaStmt);
|
||||
|
||||
COPY_STRING_FIELD(server_name);
|
||||
COPY_STRING_FIELD(remote_schema);
|
||||
COPY_STRING_FIELD(local_schema);
|
||||
COPY_SCALAR_FIELD(list_type);
|
||||
COPY_NODE_FIELD(table_list);
|
||||
COPY_NODE_FIELD(options);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static CreateTrigStmt *
|
||||
_copyCreateTrigStmt(const CreateTrigStmt *from)
|
||||
{
|
||||
@@ -4477,6 +4492,9 @@ copyObject(const void *from)
|
||||
case T_CreateForeignTableStmt:
|
||||
retval = _copyCreateForeignTableStmt(from);
|
||||
break;
|
||||
case T_ImportForeignSchemaStmt:
|
||||
retval = _copyImportForeignSchemaStmt(from);
|
||||
break;
|
||||
case T_CreateTrigStmt:
|
||||
retval = _copyCreateTrigStmt(from);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user