diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-06-05 13:41:45 +0200 |
---|---|---|
committer | mrmilosz <milosz@milosz.ca> | 2015-12-12 17:52:56 -0500 |
commit | 92109e4bbad9cdcd86dd9bf2f40bae5c26202a0d (patch) | |
tree | 5e8354711993f9f140ed97e15de34932154f2368 | |
parent | 54e5349f531df58b08243f74c03ce13ab8708263 (diff) | |
download | psycopg2-92109e4bbad9cdcd86dd9bf2f40bae5c26202a0d.tar.gz |
Correctly handle an empty error message from PQescapeIdentifier
-rw-r--r-- | psycopg/cursor_type.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index fd8fbbe..0a785c0 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1030,7 +1030,8 @@ _escape_identifier(PGconn *pgconn, const char *str, size_t length) rv = PQescapeIdentifier(pgconn, str, length); if (!rv) { char *msg; - if (!(msg = PQerrorMessage(pgconn))) { + msg = PQerrorMessage(pgconn); + if (!msg || !msg[0]) { msg = "no message provided"; } PyErr_Format(InterfaceError, "failed to escape identifier: %s", msg); |