Null query segfault fix (closes: #117).

This commit is contained in:
Federico Di Gregorio 2006-09-01 07:45:58 +00:00
parent 23112a763d
commit 6f0e578686
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2006-09-01 Federico Di Gregorio <fog@initd.org>
* psycopg/pqpath.c: applied patch from intgr (#117) to fix
segfault on null queries.
* psycopg/cursor_type.c: applied patch from intgr (#116) to
fix bad keyword naming and segfault in .executemany().

View File

@ -85,7 +85,7 @@ pq_raise(connectionObject *conn, cursorObject *curs, PyObject *exc, char *msg)
#ifdef HAVE_PQPROTOCOL3
char *pgstate =
PQresultErrorField(curs->pgres, PG_DIAG_SQLSTATE);
if (!strncmp(pgstate, "23", 2))
if (pgstate != NULL && !strncmp(pgstate, "23", 2))
exc = IntegrityError;
else
exc = ProgrammingError;