1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Finished the Between patch Christopher started.

Implements between (symmetric / asymmetric) as a node.

Executes the left or right expression once, makes a Const out of the
resulting Datum and executes the >=, <= portions out of the Const sets.

Of course, the parser does a fair amount of preparatory work for this to
happen.

Rod Taylor
This commit is contained in:
Bruce Momjian
2002-07-18 04:41:46 +00:00
parent 7ea5f1d7f1
commit 3e22406ec6
15 changed files with 619 additions and 35 deletions

View File

@@ -20,7 +20,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.141 2002/07/16 22:12:19 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.142 2002/07/18 04:41:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1769,6 +1769,33 @@ _equalCaseExpr(CaseExpr *a, CaseExpr *b)
return true;
}
static bool
_equalBetweenExpr(BetweenExpr *a, BetweenExpr *b)
{
if (!equal(a->expr, b->expr))
return false;
if (!equal(a->lexpr, b->lexpr))
return false;
if (!equal(a->rexpr, b->rexpr))
return false;
if (!equal(a->lthan, b->lthan))
return false;
if (!equal(a->gthan, b->gthan))
return false;
if (a->symmetric != b->symmetric)
return false;
if (a->not != b->not)
return false;
if (a->typeId != b->typeId)
return false;
if (a->typeLen != b->typeLen)
return false;
if (a->typeByVal != b->typeByVal)
return false;
return true;
}
static bool
_equalCaseWhen(CaseWhen *a, CaseWhen *b)
{
@@ -2217,6 +2244,9 @@ equal(void *a, void *b)
case T_CaseExpr:
retval = _equalCaseExpr(a, b);
break;
case T_BetweenExpr:
retval = _equalBetweenExpr(a, b);
break;
case T_CaseWhen:
retval = _equalCaseWhen(a, b);
break;