mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +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/readfuncs.c,v 1.182 2005/10/15 02:49:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.183 2005/12/28 01:29:59 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Path and Plan nodes do not have any readfuncs support, because we
|
||||
@ -494,10 +494,8 @@ _readSubLink(void)
|
||||
READ_LOCALS(SubLink);
|
||||
|
||||
READ_ENUM_FIELD(subLinkType, SubLinkType);
|
||||
READ_BOOL_FIELD(useOr);
|
||||
READ_NODE_FIELD(lefthand);
|
||||
READ_NODE_FIELD(testexpr);
|
||||
READ_NODE_FIELD(operName);
|
||||
READ_NODE_FIELD(operOids);
|
||||
READ_NODE_FIELD(subselect);
|
||||
|
||||
READ_DONE();
|
||||
@ -645,6 +643,23 @@ _readRowExpr(void)
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readRowCompareExpr
|
||||
*/
|
||||
static RowCompareExpr *
|
||||
_readRowCompareExpr(void)
|
||||
{
|
||||
READ_LOCALS(RowCompareExpr);
|
||||
|
||||
READ_ENUM_FIELD(rctype, RowCompareType);
|
||||
READ_NODE_FIELD(opnos);
|
||||
READ_NODE_FIELD(opclasses);
|
||||
READ_NODE_FIELD(largs);
|
||||
READ_NODE_FIELD(rargs);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readCoalesceExpr
|
||||
*/
|
||||
@ -996,6 +1011,8 @@ parseNodeString(void)
|
||||
return_value = _readArrayExpr();
|
||||
else if (MATCH("ROW", 3))
|
||||
return_value = _readRowExpr();
|
||||
else if (MATCH("ROWCOMPARE", 10))
|
||||
return_value = _readRowCompareExpr();
|
||||
else if (MATCH("COALESCE", 8))
|
||||
return_value = _readCoalesceExpr();
|
||||
else if (MATCH("MINMAX", 6))
|
||||
|
Reference in New Issue
Block a user