Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9da6d2c

Browse files
committed
ExecSubPlan needs to be able to cope with RelabelType nodes atop the
Const placeholder nodes for subplan result values.
1 parent b212e7a commit 9da6d2c

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/backend/executor/nodeSubplan.c

+20-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.23 2000/03/21 04:20:45 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.24 2000/03/23 07:32:58 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -141,16 +141,28 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
141141

142142
/*
143143
* The righthand side of the expression should be either a Const
144-
* or a function call taking a Const as arg (the function would
145-
* be a run-time type coercion inserted by the parser to get to
146-
* the input type needed by the operator). Find the Const node
147-
* and insert the actual righthand side value into it.
144+
* or a function call or RelabelType node taking a Const as arg
145+
* (these nodes represent run-time type coercions inserted by
146+
* the parser to get to the input type needed by the operator).
147+
* Find the Const node and insert the actual righthand-side value
148+
* into it.
148149
*/
149150
if (! IsA(con, Const))
150151
{
151-
Assert(IsA(con, Expr));
152-
con = lfirst(((Expr *) con)->args);
153-
Assert(IsA(con, Const));
152+
switch (con->type)
153+
{
154+
case T_Expr:
155+
con = lfirst(((Expr *) con)->args);
156+
break;
157+
case T_RelabelType:
158+
con = (Const *) (((RelabelType *) con)->arg);
159+
break;
160+
default:
161+
/* will fail below */
162+
break;
163+
}
164+
if (! IsA(con, Const))
165+
elog(ERROR, "ExecSubPlan: failed to find placeholder for subplan result");
154166
}
155167
con->constvalue = heap_getattr(tup, col, tdesc,
156168
&(con->constisnull));

0 commit comments

Comments
 (0)