Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZV0jP-0001vh-S9 for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Aug 2015 17:12:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZV0jP-0000CD-1Q for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Aug 2015 17:12:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZV0jO-0000C6-C6 for pgsql-hackers@postgresql.org; Thu, 27 Aug 2015 17:12:54 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZV0jG-0007bV-LJ for pgsql-hackers@postgresql.org; Thu, 27 Aug 2015 17:12:53 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1ZV0jE-00077q-E0; Thu, 27 Aug 2015 13:12:44 -0400 Date: Thu, 27 Aug 2015 13:12:44 -0400 From: Bruce Momjian To: Peter Eisentraut Cc: pgsql-hackers Subject: Re: [COMMITTERS] pgsql: psql: show proper row count in \x mode for zero-column output Message-ID: <20150827171244.GL29674@momjian.us> References: <558C136E.8090802@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <558C136E.8090802@gmx.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@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 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