mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Remove the recently added node types ReloptElem and OptionDefElem in favor
of adding optional namespace and action fields to DefElem. Having three node types that do essentially the same thing bloats the code and leads to errors of confusion, such as in yesterday's bug report from Khee Chin.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.427 2009/03/21 00:04:39 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.428 2009/04/04 21:12:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2098,31 +2098,10 @@ _copyDefElem(DefElem *from)
|
||||
{
|
||||
DefElem *newnode = makeNode(DefElem);
|
||||
|
||||
COPY_STRING_FIELD(defnamespace);
|
||||
COPY_STRING_FIELD(defname);
|
||||
COPY_NODE_FIELD(arg);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static OptionDefElem *
|
||||
_copyOptionDefElem(OptionDefElem *from)
|
||||
{
|
||||
OptionDefElem *newnode = makeNode(OptionDefElem);
|
||||
|
||||
COPY_SCALAR_FIELD(alter_op);
|
||||
COPY_NODE_FIELD(def);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static ReloptElem *
|
||||
_copyReloptElem(ReloptElem *from)
|
||||
{
|
||||
ReloptElem *newnode = makeNode(ReloptElem);
|
||||
|
||||
COPY_STRING_FIELD(optname);
|
||||
COPY_STRING_FIELD(nmspc);
|
||||
COPY_NODE_FIELD(arg);
|
||||
COPY_SCALAR_FIELD(defaction);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
@ -4076,12 +4055,6 @@ copyObject(void *from)
|
||||
case T_DefElem:
|
||||
retval = _copyDefElem(from);
|
||||
break;
|
||||
case T_OptionDefElem:
|
||||
retval = _copyOptionDefElem(from);
|
||||
break;
|
||||
case T_ReloptElem:
|
||||
retval = _copyReloptElem(from);
|
||||
break;
|
||||
case T_LockingClause:
|
||||
retval = _copyLockingClause(from);
|
||||
break;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.350 2009/03/10 22:09:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.351 2009/04/04 21:12:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2074,27 +2074,10 @@ _equalConstraint(Constraint *a, Constraint *b)
|
||||
static bool
|
||||
_equalDefElem(DefElem *a, DefElem *b)
|
||||
{
|
||||
COMPARE_STRING_FIELD(defnamespace);
|
||||
COMPARE_STRING_FIELD(defname);
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalOptionDefElem(OptionDefElem *a, OptionDefElem *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(alter_op);
|
||||
COMPARE_NODE_FIELD(def);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalReloptElem(ReloptElem *a, ReloptElem *b)
|
||||
{
|
||||
COMPARE_STRING_FIELD(nmspc);
|
||||
COMPARE_STRING_FIELD(optname);
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_SCALAR_FIELD(defaction);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2850,12 +2833,6 @@ equal(void *a, void *b)
|
||||
case T_DefElem:
|
||||
retval = _equalDefElem(a, b);
|
||||
break;
|
||||
case T_OptionDefElem:
|
||||
retval = _equalOptionDefElem(a, b);
|
||||
break;
|
||||
case T_ReloptElem:
|
||||
retval = _equalReloptElem(a, b);
|
||||
break;
|
||||
case T_LockingClause:
|
||||
retval = _equalLockingClause(a, b);
|
||||
break;
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.63 2009/02/02 19:31:39 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.64 2009/04/04 21:12:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -351,37 +351,37 @@ makeFuncExpr(Oid funcid, Oid rettype, List *args, CoercionForm fformat)
|
||||
/*
|
||||
* makeDefElem -
|
||||
* build a DefElem node
|
||||
*
|
||||
* This is sufficient for the "typical" case with an unqualified option name
|
||||
* and no special action.
|
||||
*/
|
||||
DefElem *
|
||||
makeDefElem(char *name, Node *arg)
|
||||
{
|
||||
DefElem *res = makeNode(DefElem);
|
||||
|
||||
res->defnamespace = NULL;
|
||||
res->defname = name;
|
||||
res->arg = arg;
|
||||
res->defaction = DEFELEM_UNSPEC;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeOptionDefElem -
|
||||
* build an OptionDefElem node
|
||||
* makeDefElemExtended -
|
||||
* build a DefElem node with all fields available to be specified
|
||||
*/
|
||||
OptionDefElem *
|
||||
makeOptionDefElem(int op, DefElem *def)
|
||||
DefElem *
|
||||
makeDefElemExtended(char *namespace, char *name, Node *arg,
|
||||
DefElemAction defaction)
|
||||
{
|
||||
OptionDefElem *res = makeNode(OptionDefElem);
|
||||
res->alter_op = op;
|
||||
res->def = def;
|
||||
return res;
|
||||
}
|
||||
DefElem *res = makeNode(DefElem);
|
||||
|
||||
ReloptElem *
|
||||
makeReloptElem(char *name, char *nmspc, Node *arg)
|
||||
{
|
||||
ReloptElem *res = makeNode(ReloptElem);
|
||||
|
||||
res->optname = name;
|
||||
res->nmspc = nmspc;
|
||||
res->defnamespace = namespace;
|
||||
res->defname = name;
|
||||
res->arg = arg;
|
||||
res->defaction = defaction;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.356 2009/03/26 17:15:34 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.357 2009/04/04 21:12:31 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@ -1797,18 +1797,10 @@ _outDefElem(StringInfo str, DefElem *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("DEFELEM");
|
||||
|
||||
WRITE_STRING_FIELD(defnamespace);
|
||||
WRITE_STRING_FIELD(defname);
|
||||
WRITE_NODE_FIELD(arg);
|
||||
}
|
||||
|
||||
static void
|
||||
_outReloptElem(StringInfo str, ReloptElem *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("RELOPTELEM");
|
||||
|
||||
WRITE_STRING_FIELD(nmspc);
|
||||
WRITE_STRING_FIELD(optname);
|
||||
WRITE_NODE_FIELD(arg);
|
||||
WRITE_ENUM_FIELD(defaction, DefElemAction);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2774,9 +2766,6 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_DefElem:
|
||||
_outDefElem(str, obj);
|
||||
break;
|
||||
case T_ReloptElem:
|
||||
_outReloptElem(str, obj);
|
||||
break;
|
||||
case T_LockingClause:
|
||||
_outLockingClause(str, obj);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user