mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Implement SQL-compliant treatment of row comparisons for < <= > >= cases
(previously we only did = and <> correctly). Also, allow row comparisons with any operators that are in btree opclasses, not only those with these specific names. This gets rid of a whole lot of indefensible assumptions about the behavior of particular operators based on their names ... though it's still true that IN and NOT IN expand to "= ANY". The patch adds a RowCompareExpr expression node type, and makes some changes in the representation of ANY/ALL/ROWCOMPARE SubLinks so that they can share code with RowCompareExpr. I have not yet done anything about making RowCompareExpr an indexable operator, but will look at that soon. initdb forced due to changes in stored rules.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.265 2005/12/20 02:30:35 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.266 2005/12/28 01:29:59 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@ -736,10 +736,8 @@ _outSubLink(StringInfo str, SubLink *node)
|
||||
WRITE_NODE_TYPE("SUBLINK");
|
||||
|
||||
WRITE_ENUM_FIELD(subLinkType, SubLinkType);
|
||||
WRITE_BOOL_FIELD(useOr);
|
||||
WRITE_NODE_FIELD(lefthand);
|
||||
WRITE_NODE_FIELD(testexpr);
|
||||
WRITE_NODE_FIELD(operName);
|
||||
WRITE_NODE_FIELD(operOids);
|
||||
WRITE_NODE_FIELD(subselect);
|
||||
}
|
||||
|
||||
@ -749,8 +747,7 @@ _outSubPlan(StringInfo str, SubPlan *node)
|
||||
WRITE_NODE_TYPE("SUBPLAN");
|
||||
|
||||
WRITE_ENUM_FIELD(subLinkType, SubLinkType);
|
||||
WRITE_BOOL_FIELD(useOr);
|
||||
WRITE_NODE_FIELD(exprs);
|
||||
WRITE_NODE_FIELD(testexpr);
|
||||
WRITE_NODE_FIELD(paramIds);
|
||||
WRITE_NODE_FIELD(plan);
|
||||
WRITE_INT_FIELD(plan_id);
|
||||
@ -855,6 +852,18 @@ _outRowExpr(StringInfo str, RowExpr *node)
|
||||
WRITE_ENUM_FIELD(row_format, CoercionForm);
|
||||
}
|
||||
|
||||
static void
|
||||
_outRowCompareExpr(StringInfo str, RowCompareExpr *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("ROWCOMPARE");
|
||||
|
||||
WRITE_ENUM_FIELD(rctype, RowCompareType);
|
||||
WRITE_NODE_FIELD(opnos);
|
||||
WRITE_NODE_FIELD(opclasses);
|
||||
WRITE_NODE_FIELD(largs);
|
||||
WRITE_NODE_FIELD(rargs);
|
||||
}
|
||||
|
||||
static void
|
||||
_outCoalesceExpr(StringInfo str, CoalesceExpr *node)
|
||||
{
|
||||
@ -1936,6 +1945,9 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_RowExpr:
|
||||
_outRowExpr(str, obj);
|
||||
break;
|
||||
case T_RowCompareExpr:
|
||||
_outRowCompareExpr(str, obj);
|
||||
break;
|
||||
case T_CoalesceExpr:
|
||||
_outCoalesceExpr(str, obj);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user