fix-libpq-error-cases.patch
text/x-diff
Filename: fix-libpq-error-cases.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/interfaces/libpq/fe-exec.c | 1 | 0 |
| src/interfaces/libpq/fe-protocol3.c | 4 | 4 |
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 78cff4475c..1b9c04f47e 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -1196,6 +1196,7 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value)
* Returns 1 if OK, 0 if error occurred.
*
* On error, *errmsgp can be set to an error string to be returned.
+ * (Such a string should already be translated via libpq_gettext().)
* If it is left NULL, the error is presumed to be "out of memory".
*
* In single-row mode, we create a new result holding just the current row,
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index 94b4a448b9..e0da22dba7 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -209,7 +209,7 @@ pqParseInput3(PGconn *conn)
case 'C': /* command complete */
if (pqGets(&conn->workBuffer, conn))
return;
- if (conn->result == NULL)
+ if (conn->result == NULL && !conn->error_result)
{
conn->result = PQmakeEmptyPGresult(conn,
PGRES_COMMAND_OK);
@@ -263,7 +263,7 @@ pqParseInput3(PGconn *conn)
}
break;
case 'I': /* empty query */
- if (conn->result == NULL)
+ if (conn->result == NULL && !conn->error_result)
{
conn->result = PQmakeEmptyPGresult(conn,
PGRES_EMPTY_QUERY);
@@ -281,7 +281,7 @@ pqParseInput3(PGconn *conn)
if (conn->cmd_queue_head &&
conn->cmd_queue_head->queryclass == PGQUERY_PREPARE)
{
- if (conn->result == NULL)
+ if (conn->result == NULL && !conn->error_result)
{
conn->result = PQmakeEmptyPGresult(conn,
PGRES_COMMAND_OK);
@@ -362,7 +362,7 @@ pqParseInput3(PGconn *conn)
if (conn->cmd_queue_head &&
conn->cmd_queue_head->queryclass == PGQUERY_DESCRIBE)
{
- if (conn->result == NULL)
+ if (conn->result == NULL && !conn->error_result)
{
conn->result = PQmakeEmptyPGresult(conn,
PGRES_COMMAND_OK);