mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Support assignment to subfields of composite columns in UPDATE and INSERT.
As a side effect, cause subscripts in INSERT targetlists to do something more or less sensible; previously we evaluated such subscripts and then effectively ignored them. Another side effect is that UPDATE-ing an element or slice of an array value that is NULL now produces a non-null result, namely an array containing just the assigned-to positions.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.223 2004/05/30 23:40:27 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.224 2004/06/09 19:08:15 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -350,6 +350,17 @@ _equalFieldSelect(FieldSelect *a, FieldSelect *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalFieldStore(FieldStore *a, FieldStore *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_NODE_FIELD(newvals);
|
||||
COMPARE_NODE_FIELD(fieldnums);
|
||||
COMPARE_SCALAR_FIELD(resulttype);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalRelabelType(RelabelType *a, RelabelType *b)
|
||||
{
|
||||
@@ -1428,7 +1439,6 @@ static bool
|
||||
_equalColumnRef(ColumnRef *a, ColumnRef *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(fields);
|
||||
COMPARE_NODE_FIELD(indirection);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1437,8 +1447,6 @@ static bool
|
||||
_equalParamRef(ParamRef *a, ParamRef *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(number);
|
||||
COMPARE_NODE_FIELD(fields);
|
||||
COMPARE_NODE_FIELD(indirection);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1474,10 +1482,9 @@ _equalAIndices(A_Indices *a, A_Indices *b)
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalExprFieldSelect(ExprFieldSelect *a, ExprFieldSelect *b)
|
||||
_equalA_Indirection(A_Indirection *a, A_Indirection *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_NODE_FIELD(fields);
|
||||
COMPARE_NODE_FIELD(indirection);
|
||||
|
||||
return true;
|
||||
@@ -1805,6 +1812,9 @@ equal(void *a, void *b)
|
||||
case T_FieldSelect:
|
||||
retval = _equalFieldSelect(a, b);
|
||||
break;
|
||||
case T_FieldStore:
|
||||
retval = _equalFieldStore(a, b);
|
||||
break;
|
||||
case T_RelabelType:
|
||||
retval = _equalRelabelType(a, b);
|
||||
break;
|
||||
@@ -2127,8 +2137,8 @@ equal(void *a, void *b)
|
||||
case T_A_Indices:
|
||||
retval = _equalAIndices(a, b);
|
||||
break;
|
||||
case T_ExprFieldSelect:
|
||||
retval = _equalExprFieldSelect(a, b);
|
||||
case T_A_Indirection:
|
||||
retval = _equalA_Indirection(a, b);
|
||||
break;
|
||||
case T_ResTarget:
|
||||
retval = _equalResTarget(a, b);
|
||||
|
||||
Reference in New Issue
Block a user