From 88e6968cc72962df658ac273183e03123f4bb569 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Thu, 9 Dec 2010 16:22:20 +0200 Subject: [PATCH] Don't segfault when PQparameterStatus(DateStyle) returns NULL pgbouncer for example does not pass on DateStyle. --- psycopg/connection_int.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index 73292b8..8451b45 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -299,6 +299,10 @@ conn_is_datestyle_ok(PGconn *pgconn) ds = PQparameterStatus(pgconn, "DateStyle"); Dprintf("conn_connect: DateStyle %s", ds); + /* pgbouncer does not pass on DateStyle */ + if (ds == NULL) + return 0; + /* Return true if ds starts with "ISO" * e.g. "ISO, DMY" is fine, "German" not. */ return (ds[0] == 'I' && ds[1] == 'S' && ds[2] == 'O'); -- 1.7.3.3