*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.140 2003/01/10 21:08:15 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.141 2003/01/13 00:18:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/params.h"
+#include "nodes/plannodes.h"
#include "parser/analyze.h"
#include "parser/gramparse.h"
#include "parser/parse.h"
elog(ERROR, "exprType: Cannot get type for untransformed sublink");
tent = (TargetEntry *) lfirst(qtree->targetList);
Assert(IsA(tent, TargetEntry));
+ Assert(!tent->resdom->resjunk);
type = tent->resdom->restype;
}
else
}
}
break;
+ case T_SubPlan:
+ {
+ /*
+ * Although the parser does not ever deal with already-planned
+ * expression trees, we support SubPlan nodes in this routine
+ * for the convenience of ruleutils.c.
+ */
+ SubPlan *subplan = (SubPlan *) expr;
+
+ if (subplan->subLinkType == EXPR_SUBLINK)
+ {
+ /* get the type of the subselect's first target column */
+ TargetEntry *tent;
+
+ tent = (TargetEntry *) lfirst(subplan->plan->targetlist);
+ Assert(IsA(tent, TargetEntry));
+ Assert(!tent->resdom->resjunk);
+ type = tent->resdom->restype;
+ }
+ else
+ {
+ /* for all other subplan types, result is boolean */
+ type = BOOLOID;
+ }
+ }
+ break;
case T_FieldSelect:
type = ((FieldSelect *) expr)->resulttype;
break;