I wrote:
>>> I propose that we should change that string to "could not obtain message
>>> string for error on connection "foo"", or something along that line.
BTW, looking closer, I notice that the dblink case already has
errcontext("Error occurred on dblink connection named \"%s\": %s.", dblink_context_conname,
dblink_context_msg)));
so we probably don't need the connection name in the primary error
message. Now I think "could not obtain message string for remote error"
would be a sufficient message.
In the postgres_fdw case, I'd be inclined to use the same replacement
primary message. Maybe we should think about adding the server name
to the errcontext there, but that seems like an independent improvement.
regards, tom lane