diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-01-01 23:48:11 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-01-01 23:48:11 -0500 |
commit | 0d692a0dc9f0e532c67c577187fe5d7d323cb95b (patch) | |
tree | 5177be3794b8ffa768a3cd852221425bd2a74347 /src/backend/nodes/copyfuncs.c | |
parent | 6600d5e91c754789002ed794c18cb856c190f58f (diff) | |
download | postgresql-0d692a0dc9f0e532c67c577187fe5d7d323cb95b.tar.gz postgresql-0d692a0dc9f0e532c67c577187fe5d7d323cb95b.zip |
Basic foreign table support.
Foreign tables are a core component of SQL/MED. This commit does
not provide a working SQL/MED infrastructure, because foreign tables
cannot yet be queried. Support for foreign table scans will need to
be added in a future patch. However, this patch creates the necessary
system catalog structure, syntax support, and support for ancillary
operations such as COMMENT and SECURITY LABEL.
Shigeru Hanada, heavily revised by Robert Haas
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index a968e375a6c..804f900c7eb 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -2575,11 +2575,15 @@ _copyCopyStmt(CopyStmt *from) return newnode; } -static CreateStmt * -_copyCreateStmt(CreateStmt *from) +/* + * CopyCreateStmtFields + * + * This function copies the fields of the CreateStmt node. It is used by + * copy functions for classes which inherit from CreateStmt. + */ +static void +CopyCreateStmtFields(CreateStmt *from, CreateStmt *newnode) { - CreateStmt *newnode = makeNode(CreateStmt); - COPY_NODE_FIELD(relation); COPY_NODE_FIELD(tableElts); COPY_NODE_FIELD(inhRelations); @@ -2589,6 +2593,14 @@ _copyCreateStmt(CreateStmt *from) COPY_SCALAR_FIELD(oncommit); COPY_STRING_FIELD(tablespacename); COPY_SCALAR_FIELD(if_not_exists); +} + +static CreateStmt * +_copyCreateStmt(CreateStmt *from) +{ + CreateStmt *newnode = makeNode(CreateStmt); + + CopyCreateStmtFields(from, newnode); return newnode; } @@ -3297,6 +3309,19 @@ _copyDropUserMappingStmt(DropUserMappingStmt *from) return newnode; } +static CreateForeignTableStmt * +_copyCreateForeignTableStmt(CreateForeignTableStmt *from) +{ + CreateForeignTableStmt *newnode = makeNode(CreateForeignTableStmt); + + CopyCreateStmtFields((CreateStmt *) from, (CreateStmt *) newnode); + + COPY_STRING_FIELD(servername); + COPY_NODE_FIELD(options); + + return newnode; +} + static CreateTrigStmt * _copyCreateTrigStmt(CreateTrigStmt *from) { @@ -4198,6 +4223,9 @@ copyObject(void *from) case T_DropUserMappingStmt: retval = _copyDropUserMappingStmt(from); break; + case T_CreateForeignTableStmt: + retval = _copyCreateForeignTableStmt(from); + break; case T_CreateTrigStmt: retval = _copyCreateTrigStmt(from); break; |