Survive missing sqlstate field on error messages
authorMarko Kreen <markokr@gmail.com>
Wed, 28 Apr 2010 07:35:06 +0000 (10:35 +0300)
committerMarko Kreen <markokr@gmail.com>
Wed, 28 Apr 2010 07:35:06 +0000 (10:35 +0300)
src/main.c

index a020c22a3f77f4d9310684a386a3eacdb3c9e087..cdfdeff0f4ffee15cea0cd4e84448d98d766d574 100644 (file)
@@ -96,6 +96,10 @@ plproxy_remote_error(ProxyFunction *func, ProxyConnection *conn, const PGresult
        const char *ctx = PQresultErrorField(res, PG_DIAG_CONTEXT);
        int elevel;
 
+       /* libpq errors may not have sqlstate */
+       if (!ss)
+               ss = "XX000";
+
        if (iserr)
                /* must ignore remote level, as it may be FATAL/PANIC */
                elevel = ERROR;