Re: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned
Date
Msg-id ZRizujD8HMMpSXG5@paquier.xyz
Whole thread Raw
In response to Re: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned  (Japin Li <japinli@hotmail.com>)
Responses Re: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, Sep 27, 2023 at 06:00:58PM +0800, Japin Li wrote:
> It seems SaveResultVariables() was lost when executing failed. Attached fix it.

Yeah, I think that you're right here, the variables should be set.
SetResultVariables() ought to be called even if \gset failed to return
a result.  We have a bunch of paths in the psql code (for backend
errors as well as errors internal to psql) where things are done this
way, and the top of SetResultVariables() even documents that.
--
Michael

Attachment

pgsql-bugs by date:

Previous
From: Jeff Janes
Date:
Subject: Re: BUG #18141: sorry, too many clients error occurring very frequently
Next
From: Michael Paquier
Date:
Subject: Re: BUG #18135: Incorrect memory access occurs when attaching a partition with an index