|
3 | 3 | * procedural language
|
4 | 4 | *
|
5 | 5 | * 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 $ |
7 | 7 | *
|
8 | 8 | * This software is copyrighted by Jan Wieck - Hamburg.
|
9 | 9 | *
|
@@ -2510,30 +2510,35 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
|
2510 | 2510 | if (plan==NULL)/* utility statement produces this */
|
2511 | 2511 | return;
|
2512 | 2512 |
|
2513 |
| -if (nodeTag(plan)!=T_Result) |
| 2513 | +if (!IsA(plan,Result)) |
2514 | 2514 | return;
|
2515 | 2515 |
|
2516 | 2516 | /* ----------
|
2517 |
| - * 3.The plan musthavea single attribute as result |
| 2517 | + * 3.Can'thaveany subplan or qual clause, either |
2518 | 2518 | * ----------
|
2519 | 2519 | */
|
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) |
2521 | 2526 | return;
|
2522 | 2527 |
|
2523 | 2528 | /* ----------
|
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 |
2526 | 2530 | * ----------
|
2527 | 2531 | */
|
2528 |
| -if (plan->qual!=NULL||plan->lefttree!=NULL||plan->righttree!=NULL) |
| 2532 | +if (length(plan->targetlist)!=1) |
2529 | 2533 | return;
|
2530 | 2534 |
|
| 2535 | +tle= (TargetEntry*)lfirst(plan->targetlist); |
| 2536 | + |
2531 | 2537 | /* ----------
|
2532 | 2538 | * 5. Check that all the nodes in the expression are one of
|
2533 | 2539 | * Expr, Param or Const.
|
2534 | 2540 | * ----------
|
2535 | 2541 | */
|
2536 |
| -tle= (TargetEntry*)lfirst(plan->targetlist); |
2537 | 2542 | if (!exec_simple_check_node(tle->expr))
|
2538 | 2543 | return;
|
2539 | 2544 |
|
@@ -2563,8 +2568,6 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
|
2563 | 2568 | default:
|
2564 | 2569 | expr->plan_simple_type=InvalidOid;
|
2565 | 2570 | }
|
2566 |
| - |
2567 |
| -return; |
2568 | 2571 | }
|
2569 | 2572 |
|
2570 | 2573 |
|
|