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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: amutu(at)amutu(dot)com
Subject: BUG #18134: ROW_COUNT do not set to 0 when psql's \gset command get no rows returned
Date: 2023-09-26 01:26:14
Message-ID: 18134-87126d90cb4dd049@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.!!!!

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2023-09-26 07:00:00 Re: BUG #17969: Assert failed in bloom_init() when false_positive_rate = 0.25
Previous Message Michael Paquier 2023-09-26 00:34:56 Re: BUG #17928: Standby fails to decode WAL on termination of primary