Commit 6197db53 authored by Tom Lane's avatar Tom Lane

Improve style of some replication-related error messages.

Put the remote end's error message into the primary error string,
instead of relegating it to errdetail().  Although this could end up
being awkward if the remote sends us a really long error message,
it seems more in keeping with our message style guidelines, and more
helpful in situations where the errdetail could get dropped.

Peter Smith

Discussion: https://postgr.es/m/CAHut+Ps-Qv2yQceCwobQDP0aJOkfDzRFrOaR6+2Op2K=WHGeWg@mail.gmail.com
parent db973ffb
...@@ -1320,17 +1320,15 @@ ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missi ...@@ -1320,17 +1320,15 @@ ReplicationSlotDropAtPubNode(WalReceiverConn *wrconn, char *slotname, bool missi
{ {
/* LOG. Error, but missing_ok = true. */ /* LOG. Error, but missing_ok = true. */
ereport(LOG, ereport(LOG,
(errmsg("could not drop the replication slot \"%s\" on publisher", (errmsg("could not drop replication slot \"%s\" on publisher: %s",
slotname), slotname, res->err)));
errdetail("The error was: %s", res->err)));
} }
else else
{ {
/* ERROR. */ /* ERROR. */
ereport(ERROR, ereport(ERROR,
(errmsg("could not drop the replication slot \"%s\" on publisher", (errmsg("could not drop replication slot \"%s\" on publisher: %s",
slotname), slotname, res->err)));
errdetail("The error was: %s", res->err)));
} }
walrcv_clear_result(res); walrcv_clear_result(res);
...@@ -1545,8 +1543,7 @@ ReportSlotConnectionError(List *rstates, Oid subid, char *slotname, char *err) ...@@ -1545,8 +1543,7 @@ ReportSlotConnectionError(List *rstates, Oid subid, char *slotname, char *err)
ereport(ERROR, ereport(ERROR,
(errmsg("could not connect to publisher when attempting to " (errmsg("could not connect to publisher when attempting to "
"drop the replication slot \"%s\"", slotname), "drop replication slot \"%s\": %s", slotname, err),
errdetail("The error was: %s", err),
/* translator: %s is an SQL ALTER command */ /* translator: %s is an SQL ALTER command */
errhint("Use %s to disassociate the subscription from the slot.", errhint("Use %s to disassociate the subscription from the slot.",
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)"))); "ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
......
...@@ -1043,8 +1043,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) ...@@ -1043,8 +1043,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
0, NULL); 0, NULL);
if (res->status != WALRCV_OK_COMMAND) if (res->status != WALRCV_OK_COMMAND)
ereport(ERROR, ereport(ERROR,
(errmsg("table copy could not start transaction on publisher"), (errmsg("table copy could not start transaction on publisher: %s",
errdetail("The error was: %s", res->err))); res->err)));
walrcv_clear_result(res); walrcv_clear_result(res);
/* /*
...@@ -1103,8 +1103,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) ...@@ -1103,8 +1103,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
res = walrcv_exec(wrconn, "COMMIT", 0, NULL); res = walrcv_exec(wrconn, "COMMIT", 0, NULL);
if (res->status != WALRCV_OK_COMMAND) if (res->status != WALRCV_OK_COMMAND)
ereport(ERROR, ereport(ERROR,
(errmsg("table copy could not finish transaction on publisher"), (errmsg("table copy could not finish transaction on publisher: %s",
errdetail("The error was: %s", res->err))); res->err)));
walrcv_clear_result(res); walrcv_clear_result(res);
table_close(rel, NoLock); table_close(rel, NoLock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment