aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-12-11 23:26:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-12-11 23:26:51 +0000
commit12b1b5d837b5ce1c07ee3535e74e4cc3039063d6 (patch)
tree1ef0ecc2ccfba9a8a33f0b20ef31533b499cbdba /src/backend/nodes/copyfuncs.c
parentfd536dd257b12a8b1abf8d744d8a3688e1db126b (diff)
downloadpostgresql-12b1b5d837b5ce1c07ee3535e74e4cc3039063d6.tar.gz
postgresql-12b1b5d837b5ce1c07ee3535e74e4cc3039063d6.zip
Instead of supposing (wrongly, in the general case) that the rowtype
of an inheritance child table is binary-compatible with the rowtype of its parent, invent an expression node type that does the conversion correctly. Fixes the new bug exhibited by Kris Shannon as well as a lot of old bugs that would only show up when using multiple inheritance or after altering the parent table.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 093965a5174..abe0ebe065d 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.293 2004/11/05 19:15:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.294 2004/12/11 23:26:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -877,6 +877,21 @@ _copyRelabelType(RelabelType *from)
}
/*
+ * _copyConvertRowtypeExpr
+ */
+static ConvertRowtypeExpr *
+_copyConvertRowtypeExpr(ConvertRowtypeExpr *from)
+{
+ ConvertRowtypeExpr *newnode = makeNode(ConvertRowtypeExpr);
+
+ COPY_NODE_FIELD(arg);
+ COPY_SCALAR_FIELD(resulttype);
+ COPY_SCALAR_FIELD(convertformat);
+
+ return newnode;
+}
+
+/*
* _copyCaseExpr
*/
static CaseExpr *
@@ -2696,6 +2711,9 @@ copyObject(void *from)
case T_RelabelType:
retval = _copyRelabelType(from);
break;
+ case T_ConvertRowtypeExpr:
+ retval = _copyConvertRowtypeExpr(from);
+ break;
case T_CaseExpr:
retval = _copyCaseExpr(from);
break;