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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: amutu(at)amutu(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned
Date: 2023-09-30 23:48:10
Message-ID: ZRizujD8HMMpSXG5@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2023-10-01 00:31:39 Re: BUG #18135: Incorrect memory access occurs when attaching a partition with an index
Previous Message Jeff Janes 2023-09-30 18:04:56 Re: BUG #18141: sorry, too many clients error occurring very frequently