Clear conn->errorMessage at successful completion of PQconnectdb().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Sep 2021 20:53:11 +0000 (16:53 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Sep 2021 20:53:11 +0000 (16:53 -0400)
commit138531f1bbc333745bd8422371c07e7e108d5528
tree25117937f630c63f46d87b10a16f921075fc53ce
parent1882d6cca161dcf9fa05ecab5abeb1a027a5cfd2
Clear conn->errorMessage at successful completion of PQconnectdb().

Commits ffa2e4670 and 52a10224e caused libpq's connection-establishment
functions to usually leave a nonempty string in the connection's
errorMessage buffer, even after a successful connection.  While that
was intentional on my part, more sober reflection says that it wasn't
a great idea: the string would be a bit confusing.  Also this broke at
least one application that checked for connection success by examining
the errorMessage, instead of using PQstatus() as documented.  Let's
clear the buffer at success exit, restoring the pre-v14 behavior.

Discussion: https://postgr.es/m/4170264.1620321747@sss.pgh.pa.us
src/interfaces/libpq/fe-connect.c