diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-12-28 01:30:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-12-28 01:30:02 +0000 |
commit | 6e07709760a29d8dbfb93b9846c905bd40689082 (patch) | |
tree | 9bf0084587d7e313ba087ce53c24bc748c63a456 /src/backend/nodes/copyfuncs.c | |
parent | a37422e042a6114ab0e513f50dac4a47fab22313 (diff) | |
download | postgresql-6e07709760a29d8dbfb93b9846c905bd40689082.tar.gz postgresql-6e07709760a29d8dbfb93b9846c905bd40689082.zip |
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.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 1d816ead3a2..7a16cbcff56 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.323 2005/12/20 02:30:35 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.324 2005/12/28 01:29:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -862,10 +862,8 @@ _copySubLink(SubLink *from) SubLink *newnode = makeNode(SubLink); COPY_SCALAR_FIELD(subLinkType); - COPY_SCALAR_FIELD(useOr); - COPY_NODE_FIELD(lefthand); + COPY_NODE_FIELD(testexpr); COPY_NODE_FIELD(operName); - COPY_NODE_FIELD(operOids); COPY_NODE_FIELD(subselect); return newnode; @@ -880,8 +878,7 @@ _copySubPlan(SubPlan *from) SubPlan *newnode = makeNode(SubPlan); COPY_SCALAR_FIELD(subLinkType); - COPY_SCALAR_FIELD(useOr); - COPY_NODE_FIELD(exprs); + COPY_NODE_FIELD(testexpr); COPY_NODE_FIELD(paramIds); COPY_NODE_FIELD(plan); COPY_SCALAR_FIELD(plan_id); @@ -1034,6 +1031,23 @@ _copyRowExpr(RowExpr *from) } /* + * _copyRowCompareExpr + */ +static RowCompareExpr * +_copyRowCompareExpr(RowCompareExpr *from) +{ + RowCompareExpr *newnode = makeNode(RowCompareExpr); + + COPY_SCALAR_FIELD(rctype); + COPY_NODE_FIELD(opnos); + COPY_NODE_FIELD(opclasses); + COPY_NODE_FIELD(largs); + COPY_NODE_FIELD(rargs); + + return newnode; +} + +/* * _copyCoalesceExpr */ static CoalesceExpr * @@ -2876,6 +2890,9 @@ copyObject(void *from) case T_RowExpr: retval = _copyRowExpr(from); break; + case T_RowCompareExpr: + retval = _copyRowCompareExpr(from); + break; case T_CoalesceExpr: retval = _copyCoalesceExpr(from); break; |