mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
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.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.359 2009/07/29 20:56:19 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.360 2009/07/30 02:45:37 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -2064,14 +2064,22 @@ static bool
|
||||
_equalConstraint(Constraint *a, Constraint *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(contype);
|
||||
COMPARE_STRING_FIELD(name);
|
||||
COMPARE_STRING_FIELD(conname);
|
||||
COMPARE_SCALAR_FIELD(deferrable);
|
||||
COMPARE_SCALAR_FIELD(initdeferred);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
COMPARE_NODE_FIELD(raw_expr);
|
||||
COMPARE_STRING_FIELD(cooked_expr);
|
||||
COMPARE_NODE_FIELD(keys);
|
||||
COMPARE_NODE_FIELD(options);
|
||||
COMPARE_STRING_FIELD(indexspace);
|
||||
COMPARE_SCALAR_FIELD(deferrable);
|
||||
COMPARE_SCALAR_FIELD(initdeferred);
|
||||
COMPARE_NODE_FIELD(pktable);
|
||||
COMPARE_NODE_FIELD(fk_attrs);
|
||||
COMPARE_NODE_FIELD(pk_attrs);
|
||||
COMPARE_SCALAR_FIELD(fk_matchtype);
|
||||
COMPARE_SCALAR_FIELD(fk_upd_action);
|
||||
COMPARE_SCALAR_FIELD(fk_del_action);
|
||||
COMPARE_SCALAR_FIELD(skip_validation);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2189,23 +2197,6 @@ _equalCommonTableExpr(CommonTableExpr *a, CommonTableExpr *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalFkConstraint(FkConstraint *a, FkConstraint *b)
|
||||
{
|
||||
COMPARE_STRING_FIELD(constr_name);
|
||||
COMPARE_NODE_FIELD(pktable);
|
||||
COMPARE_NODE_FIELD(fk_attrs);
|
||||
COMPARE_NODE_FIELD(pk_attrs);
|
||||
COMPARE_SCALAR_FIELD(fk_matchtype);
|
||||
COMPARE_SCALAR_FIELD(fk_upd_action);
|
||||
COMPARE_SCALAR_FIELD(fk_del_action);
|
||||
COMPARE_SCALAR_FIELD(deferrable);
|
||||
COMPARE_SCALAR_FIELD(initdeferred);
|
||||
COMPARE_SCALAR_FIELD(skip_validation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalXmlSerialize(XmlSerialize *a, XmlSerialize *b)
|
||||
{
|
||||
@@ -2859,9 +2850,6 @@ equal(void *a, void *b)
|
||||
case T_CommonTableExpr:
|
||||
retval = _equalCommonTableExpr(a, b);
|
||||
break;
|
||||
case T_FkConstraint:
|
||||
retval = _equalFkConstraint(a, b);
|
||||
break;
|
||||
case T_PrivGrantee:
|
||||
retval = _equalPrivGrantee(a, b);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user