mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +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:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.194 2002/07/16 22:12:19 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.195 2002/07/18 04:41:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -999,6 +999,32 @@ _copyCaseExpr(CaseExpr *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyBetweenExpr
|
||||
* ----------------
|
||||
*/
|
||||
static BetweenExpr *
|
||||
_copyBetweenExpr(BetweenExpr *from)
|
||||
{
|
||||
BetweenExpr *newnode = makeNode(BetweenExpr);
|
||||
|
||||
/*
|
||||
* copy remainder of node
|
||||
*/
|
||||
Node_Copy(from, newnode, expr);
|
||||
Node_Copy(from, newnode, lexpr);
|
||||
Node_Copy(from, newnode, rexpr);
|
||||
Node_Copy(from, newnode, lthan);
|
||||
Node_Copy(from, newnode, gthan);
|
||||
newnode->symmetric = from->symmetric;
|
||||
newnode->not = from->not;
|
||||
newnode->typeId = from->typeId;
|
||||
newnode->typeLen = from->typeLen;
|
||||
newnode->typeByVal = from->typeByVal;
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyCaseWhen
|
||||
* ----------------
|
||||
@ -3052,6 +3078,9 @@ copyObject(void *from)
|
||||
case T_CaseExpr:
|
||||
retval = _copyCaseExpr(from);
|
||||
break;
|
||||
case T_BetweenExpr:
|
||||
retval = _copyBetweenExpr(from);
|
||||
break;
|
||||
case T_CaseWhen:
|
||||
retval = _copyCaseWhen(from);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user