pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: psql: show proper row count in \x mode for zero-column output
4+ messages / 3 participants
[nested] [flat]

* pgsql: psql: show proper row count in \x mode for zero-column output
@ 2015-03-25 01:04  Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruce Momjian @ 2015-03-25 01:04 UTC (permalink / raw)
  To: pgsql-committers

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

Modified Files
--------------
src/bin/psql/print.c |   25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [COMMITTERS] pgsql: psql: show proper row count in \x mode for zero-column output
@ 2015-06-25 14:42  Peter Eisentraut <peter_e@gmx.net>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Peter Eisentraut @ 2015-06-25 14:42 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; pgsql-hackers <pgsql-hackers@postgresql.org>

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?



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Re: [COMMITTERS] pgsql: psql: show proper row count in \x mode for zero-column output
@ 2015-06-26 22:38  Jim Nasby <Jim.Nasby@BlueTreble.com>
  parent: Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 4+ messages in thread

From: Jim Nasby @ 2015-06-26 22:38 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; Bruce Momjian <bruce@momjian.us>; pgsql-hackers <pgsql-hackers@postgresql.org>

On 6/25/15 9:42 AM, 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?

That's consistent with what > 0 rows does, so it seems the correct thing 
to do. Going from "(No rows)" to "(0 rows)" is going to break things 
anyway, so I don't see a backwards compatibility issue here.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Data in Trouble? Get it in Treble! http://BlueTreble.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [COMMITTERS] pgsql: psql: show proper row count in \x mode for zero-column output
@ 2015-08-27 17:12  Bruce Momjian <bruce@momjian.us>
  parent: Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2015-08-27 17:12 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-hackers <pgsql-hackers@postgresql.org>

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@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2015-08-27 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 01:04 pgsql: psql: show proper row count in \x mode for zero-column output Bruce Momjian <bruce@momjian.us>
2015-06-25 14:42 ` Peter Eisentraut <peter_e@gmx.net>
2015-06-26 22:38   ` Jim Nasby <Jim.Nasby@BlueTreble.com>
2015-08-27 17:12   ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox