mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Don't segfault when PQparameterStatus(DateStyle) returns NULL
pgbouncer for example does not pass on DateStyle.
This commit is contained in:
parent
5a0cfad95f
commit
a08419406c
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue
Block a user