summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-protocol3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-protocol3.c')
-rw-r--r--src/interfaces/libpq/fe-protocol3.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index dbc0d89a4ed..641804cb068 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -250,7 +250,7 @@ pqParseInput3(PGconn *conn)
if (!conn->result)
{
printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@@ -321,7 +321,7 @@ pqParseInput3(PGconn *conn)
if (!conn->result)
{
printfPQExpBuffer(&conn->errorMessage,
- libpq_gettext("out of memory"));
+ libpq_gettext("out of memory"));
pqSaveErrorResult(conn);
}
}
@@ -934,9 +934,14 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
val = PQresultErrorField(res, PG_DIAG_INTERNAL_QUERY);
if (val)
appendPQExpBuffer(&workBuf, libpq_gettext("QUERY: %s\n"), val);
- val = PQresultErrorField(res, PG_DIAG_CONTEXT);
- if (val)
- appendPQExpBuffer(&workBuf, libpq_gettext("CONTEXT: %s\n"), val);
+ if (conn->show_context == PQSHOW_CONTEXT_ALWAYS ||
+ (conn->show_context == PQSHOW_CONTEXT_ERRORS && isError))
+ {
+ val = PQresultErrorField(res, PG_DIAG_CONTEXT);
+ if (val)
+ appendPQExpBuffer(&workBuf, libpq_gettext("CONTEXT: %s\n"),
+ val);
+ }
}
if (conn->verbosity == PQERRORS_VERBOSE)
{