Re: [COMMITTERS] pgsql: psql: show proper row count in \x mode for zero-column output

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: psql: show proper row count in \x mode for zero-column output
Date: 2015-08-27 17:12:44
Message-ID: 20150827171244.GL29674@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Thu, Jun 25, 2015 at 10:42:54AM -0400, Peter Eisentraut wrote:
> On 3/24/15 9:04 PM, Bruce Momjian wrote:
> > psql: show proper row count in \x mode for zero-column output
> >
> > Also, fix pager enable selection for such cases, and other cleanups for
> > zero-column output.
> >
> > Report by Thom Brown
> >
> > Branch
> > ------
> > master
> >
> > Details
> > -------
> > http://git.postgresql.org/pg/commitdiff/376a0c4547fe98c45476647596ce9c9b394f8415
>
> This change added an extra blank line to the output of a zero-row result.
>
> Compare:
>
> [9.4]
> $ psql -X -d postgres -c 'select * from pg_class where false' -x
> (No rows)
> $
>
> [9.5]
> $ psql -X -d postgres -c 'select * from pg_class where false' -x
> (0 rows)
>
> $
>
>
> Was that intentional?

I think so. ;-) We get a blank line for output of rows in -x:

$ psql -X -d postgres -c 'select * from pg_class where 1=1' -x
...
relispopulated | t
relreplident | n
relfrozenxid | 0
relminmxid | 0
relacl | {postgres=arwdDxt/postgres,=r/postgres}
reloptions |
-->
$

and for no rows without -x:

$ psql -X -d postgres -c 'select * from pg_class where 1=0'
relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | ...
---------+--------------+---------+-----------+----------+-------+-------------+-...
(0 rows)
-->
$

and when we return rows without -x:

$ psql -X -d postgres -c 'select * from pg_class where 1=1'
...
s,=r/postgres} |
user_mappings | 12086 | 12359 | 0 | ...
(311 rows)
-->
$

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2015-08-27 17:43:23 pgsql: dblink docs: fix typo to use "connname" (3 n's), not "conname"
Previous Message Tom Lane 2015-08-27 16:22:17 pgsql: Add a small cache of locks owned by a resource owner in Resource

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2015-08-27 17:37:10 Re: missing locking in at least INSERT INTO view WITH CHECK
Previous Message Tom Lane 2015-08-27 16:24:23 Re: Resource Owner reassign Locks