chomp PQerrorMessage() in backend uses

Started by Peter Eisentrautabout 9 years ago3 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

Here is a patch to systematically trim the trailing newlines off
PQerrorMessage() results in backend uses (dblink, postgres_fdw,
libpqwalreceiver).

I noticed that there are some inconsistent assumptions about whether
PQerrorMessage() can ever return NULL. From the code, I think that
should not be possible, but some code appears to be prepared for it.
Other code is not. What is correct?

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-chomp-PQerrorMessage-in-backend-uses.patchtext/x-patch; name=0001-chomp-PQerrorMessage-in-backend-uses.patchDownload+41-38
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: chomp PQerrorMessage() in backend uses

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:

Here is a patch to systematically trim the trailing newlines off
PQerrorMessage() results in backend uses (dblink, postgres_fdw,
libpqwalreceiver).

+1

I noticed that there are some inconsistent assumptions about whether
PQerrorMessage() can ever return NULL. From the code, I think that
should not be possible, but some code appears to be prepared for it.
Other code is not. What is correct?

libpq.sgml doesn't specify, so it's hard to argue that either position
is "correct". I don't mind resolving the ambiguity via a documentation
change though. I'd want to see it also cover other corner cases like
what if there hasn't been an error on the connection.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#2)
Re: chomp PQerrorMessage() in backend uses

On 2/8/17 11:00, Tom Lane wrote:

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:

Here is a patch to systematically trim the trailing newlines off
PQerrorMessage() results in backend uses (dblink, postgres_fdw,
libpqwalreceiver).

+1

committed

I noticed that there are some inconsistent assumptions about whether
PQerrorMessage() can ever return NULL. From the code, I think that
should not be possible, but some code appears to be prepared for it.
Other code is not. What is correct?

libpq.sgml doesn't specify, so it's hard to argue that either position
is "correct". I don't mind resolving the ambiguity via a documentation
change though. I'd want to see it also cover other corner cases like
what if there hasn't been an error on the connection.

I didn't dare to venture deeper into this right now. The committed
change shouldn't gain or lose anything with respect to this question.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers