mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Implement CASE expression.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.50 1998/11/22 10:48:38 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.51 1998/12/04 15:33:33 thomas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -943,6 +943,47 @@ _copySubLink(SubLink *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyCaseExpr
|
||||
* ----------------
|
||||
*/
|
||||
static CaseExpr *
|
||||
_copyCaseExpr(CaseExpr *from)
|
||||
{
|
||||
CaseExpr *newnode = makeNode(CaseExpr);
|
||||
|
||||
/* ----------------
|
||||
* copy remainder of node
|
||||
* ----------------
|
||||
*/
|
||||
newnode->casetype = from->casetype;
|
||||
|
||||
Node_Copy(from, newnode, arg);
|
||||
Node_Copy(from, newnode, args);
|
||||
Node_Copy(from, newnode, defresult);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyCaseWhen
|
||||
* ----------------
|
||||
*/
|
||||
static CaseWhen *
|
||||
_copyCaseWhen(CaseWhen *from)
|
||||
{
|
||||
CaseWhen *newnode = makeNode(CaseWhen);
|
||||
|
||||
/* ----------------
|
||||
* copy remainder of node
|
||||
* ----------------
|
||||
*/
|
||||
Node_Copy(from, newnode, expr);
|
||||
Node_Copy(from, newnode, result);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static Array *
|
||||
_copyArray(Array *from)
|
||||
{
|
||||
@ -1734,6 +1775,12 @@ copyObject(void *from)
|
||||
case T_SubLink:
|
||||
retval = _copySubLink(from);
|
||||
break;
|
||||
case T_CaseExpr:
|
||||
retval = _copyCaseExpr(from);
|
||||
break;
|
||||
case T_CaseWhen:
|
||||
retval = _copyCaseWhen(from);
|
||||
break;
|
||||
|
||||
/*
|
||||
* RELATION NODES
|
||||
|
Reference in New Issue
Block a user