diff options
| author | Marti Raudsepp <marti@juffo.org> | 2010-12-09 16:22:20 +0200 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-12-18 15:27:15 +0000 |
| commit | a08419406cdb52a4d0b1f7ac3dbc2f655b5ed67d (patch) | |
| tree | 9a83df3e4f06c482f7bab2f56aaa7b7142485abe /psycopg/connection_int.c | |
| parent | 5a0cfad95f85859607623551d45e46e8b469953d (diff) | |
| download | psycopg2-a08419406cdb52a4d0b1f7ac3dbc2f655b5ed67d.tar.gz | |
Don't segfault when PQparameterStatus(DateStyle) returns NULL
pgbouncer for example does not pass on DateStyle.
Diffstat (limited to 'psycopg/connection_int.c')
| -rw-r--r-- | 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'); |
