]> granicus.if.org Git - postgresql/commitdiff
Defend against null input in analyze_requires_snapshot(), per report
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Jan 2009 13:42:33 +0000 (13:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Jan 2009 13:42:33 +0000 (13:42 +0000)
from Rushabh Lathia.

src/backend/parser/analyze.c

index 9c896b07f686cc8801b8c9b8124b3d758be2a042..6b54e9ba1731f2d1e234f4f5d885dd66089ca47c 100644 (file)
@@ -17,7 +17,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.386 2009/01/01 17:23:45 momjian Exp $
+ *     $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.387 2009/01/08 13:42:33 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -222,13 +222,17 @@ transformStmt(ParseState *pstate, Node *parseTree)
  *             Returns true if a snapshot must be set before doing parse analysis
  *             on the given raw parse tree.
  *
- * Classification here should match transformStmt().
+ * Classification here should match transformStmt(); but we also have to
+ * allow a NULL input (for Parse/Bind of an empty query string).
  */
 bool
 analyze_requires_snapshot(Node *parseTree)
 {
        bool            result;
 
+       if (parseTree == NULL)
+               return false;
+
        switch (nodeTag(parseTree))
        {
                        /*