Plug hole in dike: planner would coredump if query_planner
authorTom Lane
Sat, 12 Jun 1999 19:27:41 +0000 (19:27 +0000)
committerTom Lane
Sat, 12 Jun 1999 19:27:41 +0000 (19:27 +0000)
returned NULL, which it will do in some cases where an elog(ERROR) would
probably be more appropriate.  For the moment, generate a not-very-
informative error message rather than proceeding to certain coredump.
Probably ought to think about making query_planner elog instead of
returning NULL, but this is at least a safe change for now.

src/backend/optimizer/plan/planner.c

index 6dc76f0fa2d835e1e6072b37c2f240f8b085d1f9..ef2e8ca00b08736e0e7804c532dcf0a8b848f5e6 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.55 1999/06/06 17:38:10 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.56 1999/06/12 19:27:41 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -223,6 +223,10 @@ union_planner(Query *parse)
            pfree(vpm);
    }
 
+   /* query_planner returns NULL if it thinks plan is bogus */
+   if (! result_plan)
+       elog(ERROR, "union_planner: failed to create plan");
+
    /*
     * If we have a GROUP BY clause, insert a group node (with the
     * appropriate sort node.)