diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-07-10 15:01:31 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-07-10 15:01:43 -0400 |
commit | 59efda3e50ca4de6a9d5aa4491464e22b6329b1e (patch) | |
tree | 23a2fe16ebc11ad9f95ef3f70c563084d6ca4007 /src/backend/nodes/copyfuncs.c | |
parent | 6a605cd6bd9f689b35676623add0de9b90978bf1 (diff) |
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
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 8d3d5a7c734..30885789304 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -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; |