Re: error handling in pqRowProcessor broken

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-04-21T20:18:52Z
Lists: pgsql-hackers
On 19.04.22 21:16, Tom Lane wrote:
> Peter Eisentraut<peter.eisentraut@enterprisedb.com>  writes:
>> I find that this doesn't work anymore.  If you set *errmsgp = "some
>> message" and return 0, then psql will just print a result set with zero
>> rows.
> Ah, I see the problem: a few places in fe-protocol3 didn't get the memo
> that conn->error_result represents a "pending" PGresult that hasn't
> been constructed yet.  The attached fixes it for me --- can you try it
> on whatever test case led you to this?

Your patch fixes it for me.



Commits

  1. Fix missed cases in libpq's error handling.

  2. Rearrange libpq's error reporting to avoid duplicated error text.