]> granicus.if.org Git - postgresql/commitdiff
Insert a test for missing targetlist entry in replace_agg_clause.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 26 Apr 1999 00:37:46 +0000 (00:37 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 26 Apr 1999 00:37:46 +0000 (00:37 +0000)
src/backend/optimizer/plan/setrefs.c

index 53ebd8c34ddb8dc3b4c652617fee4298d52437e8..3584cda153508067ec249d1386c0e9671b1cca82 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.41 1999/04/19 01:43:12 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.42 1999/04/26 00:37:46 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -599,9 +599,11 @@ replace_result_clause(Node *clause,
                 */
                subplanVar = match_varid((Var *) clause, subplanTargetList);
 
+               if (! subplanVar)
+                       elog(ERROR, "replace_result_clause: variable not in target list");
+
                /*
                 * Change the varno & varattno fields of the var node.
-                *
                 */
                ((Var *) clause)->varno = (Index) OUTER;
                ((Var *) clause)->varattno = subplanVar->resdom->resno;
@@ -754,10 +756,11 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
                 */
                subplanVar = match_varid((Var *) clause, subplanTargetList);
 
+               if (! subplanVar)
+                       elog(ERROR, "replace_agg_clause: variable not in target list");
+
                /*
                 * Change the varno & varattno fields of the var node.
-                * Note we assume match_varid() will succeed ...
-                *
                 */
                ((Var *) clause)->varattno = subplanVar->resdom->resno;