From 6f0e578686ccd6de6b9aa61b16140081c9278301 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Fri, 1 Sep 2006 07:45:58 +0000 Subject: [PATCH] Null query segfault fix (closes: #117). --- ChangeLog | 3 +++ psycopg/pqpath.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3037f5d7..7be819a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-09-01 Federico Di Gregorio + * 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(). diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index 7bceed20..1ebb569c 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -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;