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

Commit73f5b08

Browse files
committed
exec_simple_check_plan() must not allow a plan having initPlans or
subPlans to be considered 'simple'. This fixes reported problem with'return exists (select 1 from foo);' in plpgsql function.
1 parentf3a9d75 commit73f5b08

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.18 2000/02/07 03:39:13 inoue Exp $
6+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.19 2000/03/11 06:19:00 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -2510,30 +2510,35 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
25102510
if (plan==NULL)/* utility statement produces this */
25112511
return;
25122512

2513-
if (nodeTag(plan)!=T_Result)
2513+
if (!IsA(plan,Result))
25142514
return;
25152515

25162516
/* ----------
2517-
* 3.The plan musthavea single attribute as result
2517+
* 3.Can'thaveany subplan or qual clause, either
25182518
* ----------
25192519
*/
2520-
if (length(plan->targetlist)!=1)
2520+
if (plan->lefttree!=NULL||
2521+
plan->righttree!=NULL||
2522+
plan->initPlan!=NULL||
2523+
plan->subPlan!=NULL||
2524+
plan->qual!=NULL||
2525+
((Result*)plan)->resconstantqual!=NULL)
25212526
return;
25222527

25232528
/* ----------
2524-
* 4. Don't know if all these can break us, so let SPI handle
2525-
* those plans
2529+
* 4. The plan must have a single attribute as result
25262530
* ----------
25272531
*/
2528-
if (plan->qual!=NULL||plan->lefttree!=NULL||plan->righttree!=NULL)
2532+
if (length(plan->targetlist)!=1)
25292533
return;
25302534

2535+
tle= (TargetEntry*)lfirst(plan->targetlist);
2536+
25312537
/* ----------
25322538
* 5. Check that all the nodes in the expression are one of
25332539
* Expr, Param or Const.
25342540
* ----------
25352541
*/
2536-
tle= (TargetEntry*)lfirst(plan->targetlist);
25372542
if (!exec_simple_check_node(tle->expr))
25382543
return;
25392544

@@ -2563,8 +2568,6 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
25632568
default:
25642569
expr->plan_simple_type=InvalidOid;
25652570
}
2566-
2567-
return;
25682571
}
25692572

25702573

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp