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

From: Jov <amutu(at)amutu(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: 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 06:36:18
Message-ID: CADyrUxN2+vOCWarbcyw4rQ5XzVbsLJscFh_5tPVvL49YMYrxfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I conformed this patch fix the problem, thanks!

Japin Li <japinli(at)hotmail(dot)com> 于2023年9月28日周四 10:51写道:

>
> On Tue, 26 Sep 2023 at 09:26, PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
> > The following bug has been logged on the website:
> >
> > Bug reference: 18134
> > Logged by: amutu
> > Email address: amutu(at)amutu(dot)com
> > PostgreSQL version: 15.4
> > Operating system: FreeBSD 13.2-RELEASE amd64
> > Description:
> >
> > reproduce steps:
> >
> > $psql postgres
> > psql (15.4)
> > Type "help" for help.
> >
> > postgres=# select * from cmdq where status= 'new' \gset
> > no rows returned for \gset
> > postgres=# \echo :ROW_COUNT
> > :ROW_COUNT
> > postgres=# select * from cmdq;
> > cmd | src_ip | worker | status | ts |
> id
> >
> >
> ---------+-----------+--------+--------+-------------------------------+----
> > ls /tmp | 127.0.0.1 | | done | 2023-09-23 14:39:59.047309+08 |
> > 1
> > (1 row)
> >
> > postgres=# \echo :ROW_COUNT
> > 1
> > postgres=# select * from cmdq where status= 'new' \gset
> > no rows returned for \gset
> > postgres=# \echo :ROW_COUNT
> > 1
> > ------------------------------------------------
> > from the psql doc:
> > ROW_COUNT
> > The number of rows returned or affected by the last SQL query, !!!!or 0
> if
> > the query failed or did not report a row count.!!!!
>
> It seems SaveResultVariables() was lost when executing failed. Attached
> fix it.
>
>
> --
> Regrads,
> Japin Li
> ChengDu WenWu Information Technology Co., Ltd.
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jorge Soro Domenech 2023-09-30 10:33:38 Help pg_restore version
Previous Message Bruce Momjian 2023-09-29 18:32:33 Re: BUG #18137: PG16 release note doc bug in "Allow GRANT group_name TO user_name ..."