summaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-07-30 02:45:38 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-07-30 02:45:38 +0000
commit060baf27844163c0874c72d7baf08d3bf9a8ffce (patch)
treeb011e0000cb299f0c9ffb634931e30fcec3d2094 /src/backend/nodes/copyfuncs.c
parent78aef14c5935bca92d0cacaa9d188f588d7f2444 (diff)
Merge the Constraint and FkConstraint node types into a single type.
This was foreseen to be a good idea long ago, but nobody had got round to doing it. The recent patch for deferred unique constraints made transformConstraintAttrs() ugly enough that I decided it was time. This change will also greatly simplify parsing of deferred CHECK constraints, if anyone ever gets around to implementing that. While at it, add a location field to Constraint, and use that to provide an error cursor for some of the constraint-related error messages.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index d10a9eb6cc5..48039b86cb9 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.436 2009/07/29 20:56:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.437 2009/07/30 02:45:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1738,25 +1738,6 @@ _copyRangeTblEntry(RangeTblEntry *from)
return newnode;
}
-static FkConstraint *
-_copyFkConstraint(FkConstraint *from)
-{
- FkConstraint *newnode = makeNode(FkConstraint);
-
- COPY_STRING_FIELD(constr_name);
- COPY_NODE_FIELD(pktable);
- COPY_NODE_FIELD(fk_attrs);
- COPY_NODE_FIELD(pk_attrs);
- COPY_SCALAR_FIELD(fk_matchtype);
- COPY_SCALAR_FIELD(fk_upd_action);
- COPY_SCALAR_FIELD(fk_del_action);
- COPY_SCALAR_FIELD(deferrable);
- COPY_SCALAR_FIELD(initdeferred);
- COPY_SCALAR_FIELD(skip_validation);
-
- return newnode;
-}
-
static SortGroupClause *
_copySortGroupClause(SortGroupClause *from)
{
@@ -2085,14 +2066,22 @@ _copyConstraint(Constraint *from)
Constraint *newnode = makeNode(Constraint);
COPY_SCALAR_FIELD(contype);
- COPY_STRING_FIELD(name);
+ COPY_STRING_FIELD(conname);
+ COPY_SCALAR_FIELD(deferrable);
+ COPY_SCALAR_FIELD(initdeferred);
+ COPY_LOCATION_FIELD(location);
COPY_NODE_FIELD(raw_expr);
COPY_STRING_FIELD(cooked_expr);
COPY_NODE_FIELD(keys);
COPY_NODE_FIELD(options);
COPY_STRING_FIELD(indexspace);
- COPY_SCALAR_FIELD(deferrable);
- COPY_SCALAR_FIELD(initdeferred);
+ COPY_NODE_FIELD(pktable);
+ COPY_NODE_FIELD(fk_attrs);
+ COPY_NODE_FIELD(pk_attrs);
+ COPY_SCALAR_FIELD(fk_matchtype);
+ COPY_SCALAR_FIELD(fk_upd_action);
+ COPY_SCALAR_FIELD(fk_del_action);
+ COPY_SCALAR_FIELD(skip_validation);
return newnode;
}
@@ -4082,9 +4071,6 @@ copyObject(void *from)
case T_CommonTableExpr:
retval = _copyCommonTableExpr(from);
break;
- case T_FkConstraint:
- retval = _copyFkConstraint(from);
- break;
case T_PrivGrantee:
retval = _copyPrivGrantee(from);
break;