1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +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

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.163 2002/07/16 22:12:19 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.164 2002/07/18 04:41:44 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -1483,6 +1483,38 @@ _outCaseWhen(StringInfo str, CaseWhen *node)
_outNode(str, node->result);
}
/*
* BetweenExpr
*/
static void
_outBetweenExpr(StringInfo str, BetweenExpr *node)
{
appendStringInfo(str, " BETWEENEXPR :expr ");
_outNode(str, node->expr);
appendStringInfo(str, " :not %s",
booltostr(node->not));
appendStringInfo(str, " :symmetric %s",
booltostr(node->symmetric));
appendStringInfo(str, " :lexpr ");
_outNode(str, node->lexpr);
appendStringInfo(str, " :rexpr ");
_outNode(str, node->rexpr);
appendStringInfo(str, " :gthan ");
_outNode(str, node->gthan);
appendStringInfo(str, " :lthan ");
_outNode(str, node->lthan);
appendStringInfo(str, " :typeid %u :typelen %d :typebyval %s",
node->typeId, node->typeLen,
booltostr(node->typeByVal));
}
/*
* NullTest
*/
@@ -1767,6 +1799,9 @@ _outNode(StringInfo str, void *obj)
case T_CaseExpr:
_outCaseExpr(str, obj);
break;
case T_BetweenExpr:
_outBetweenExpr(str, obj);
break;
case T_CaseWhen:
_outCaseWhen(str, obj);
break;