|
7 | 7 | * Portions Copyright (c) 1994, Regents of the University of California |
8 | 8 | * |
9 | 9 | * 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 $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -141,16 +141,28 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull) |
141 | 141 |
|
142 | 142 | /* |
143 | 143 | * 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. |
148 | 149 | */ |
149 | 150 | if (!IsA(con,Const)) |
150 | 151 | { |
151 | | -Assert(IsA(con,Expr)); |
152 | | -con=lfirst(((Expr*)con)->args); |
153 | | -Assert(IsA(con,Const)); |
| 152 | +switch (con->type) |
| 153 | +{ |
| 154 | +caseT_Expr: |
| 155 | +con=lfirst(((Expr*)con)->args); |
| 156 | +break; |
| 157 | +caseT_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"); |
154 | 166 | } |
155 | 167 | con->constvalue=heap_getattr(tup,col,tdesc, |
156 | 168 | &(con->constisnull)); |
|