diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-30 16:59:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-30 16:59:10 +0000 |
commit | b1abb3340b02d77227d9419f424ef936d7cde1d8 (patch) | |
tree | 827e4ad148fa17cd7e403b3148d5dccebc6855cb | |
parent | 5298d511ee823fa8ee5cf7f9df764b37a5a64e12 (diff) | |
download | postgresql-b1abb3340b02d77227d9419f424ef936d7cde1d8.tar.gz postgresql-b1abb3340b02d77227d9419f424ef936d7cde1d8.zip |
Defend against null input in analyze_requires_snapshot(), per report
from Rushabh Lathia.
Back-patch of patch of 2009-01-08. This is necessary in 8.3, as reported
by Bjorn Munch. It's not currently necessary in 8.2, AFAICS, but seems
best to include it there too.
-rw-r--r-- | src/backend/parser/analyze.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 4a539a1e1e8..4c28de6aa25 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -17,7 +17,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.371.2.1 2008/12/13 02:00:29 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.371.2.2 2009/01/30 16:59:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -232,13 +232,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)) { /* |