Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd1686b4

Browse files
committed
Recent changes in sublink representation require exprType() to accept
SubPlan nodes, else explaining queries containing sublinks may fail.
1 parentd4ce5a4 commitd1686b4

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.140 2003/01/10 21:08:15 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.141 2003/01/13 00:18:51 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -20,6 +20,7 @@
2020
#include"miscadmin.h"
2121
#include"nodes/makefuncs.h"
2222
#include"nodes/params.h"
23+
#include"nodes/plannodes.h"
2324
#include"parser/analyze.h"
2425
#include"parser/gramparse.h"
2526
#include"parser/parse.h"
@@ -962,6 +963,7 @@ exprType(Node *expr)
962963
elog(ERROR,"exprType: Cannot get type for untransformed sublink");
963964
tent= (TargetEntry*)lfirst(qtree->targetList);
964965
Assert(IsA(tent,TargetEntry));
966+
Assert(!tent->resdom->resjunk);
965967
type=tent->resdom->restype;
966968
}
967969
else
@@ -971,6 +973,32 @@ exprType(Node *expr)
971973
}
972974
}
973975
break;
976+
caseT_SubPlan:
977+
{
978+
/*
979+
* Although the parser does not ever deal with already-planned
980+
* expression trees, we support SubPlan nodes in this routine
981+
* for the convenience of ruleutils.c.
982+
*/
983+
SubPlan*subplan= (SubPlan*)expr;
984+
985+
if (subplan->subLinkType==EXPR_SUBLINK)
986+
{
987+
/* get the type of the subselect's first target column */
988+
TargetEntry*tent;
989+
990+
tent= (TargetEntry*)lfirst(subplan->plan->targetlist);
991+
Assert(IsA(tent,TargetEntry));
992+
Assert(!tent->resdom->resjunk);
993+
type=tent->resdom->restype;
994+
}
995+
else
996+
{
997+
/* for all other subplan types, result is boolean */
998+
type=BOOLOID;
999+
}
1000+
}
1001+
break;
9741002
caseT_FieldSelect:
9751003
type= ((FieldSelect*)expr)->resulttype;
9761004
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp