psql omits row count under "\x auto"

Lists: pgsql-hackers
From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: peter_e(at)gmx(dot)net
Subject: psql omits row count under "\x auto"
Date: 2012-04-23 16:30:03
Message-ID: 20120423163003.GB20512@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I've been enjoying "\x auto" in .psqlrc, but I noticed the row count footer
missing when it chooses ordinary output:

[local] test=# \x off
Expanded display is off.
[local] test=# select 1;
?column?
----------
1
(1 row)

[local] test=# \x auto
Expanded display is used automatically.
[local] test=# select 1;
?column?
----------
1

[local] test=#

Looks like the logic in printQuery() needs further treatment.

Thanks,
nm


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: psql omits row count under "\x auto"
Date: 2012-04-25 20:57:36
Message-ID: CA+TgmoZs83mW+42KucCH8QsHgTMyewSWidyMQCRSzsZKJzwHvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Apr 23, 2012 at 12:30 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> Looks like the logic in printQuery() needs further treatment.

Do you want to propose a patch, or are you hoping someone else is
going to address this?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Noah Misch <noah(at)leadboat(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, peter_e(at)gmx(dot)net
Subject: Re: psql omits row count under "\x auto"
Date: 2012-04-26 02:17:33
Message-ID: 20120426021733.GC8116@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 25, 2012 at 04:57:36PM -0400, Robert Haas wrote:
> On Mon, Apr 23, 2012 at 12:30 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> > Looks like the logic in printQuery() needs further treatment.
>
> Do you want to propose a patch, or are you hoping someone else is
> going to address this?

I figured Peter might have a preference for how to fix it. If not, I can put
something together.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql omits row count under "\x auto"
Date: 2012-04-26 18:25:25
Message-ID: 1335464725.14211.5.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On mån, 2012-04-23 at 12:30 -0400, Noah Misch wrote:
> I've been enjoying "\x auto" in .psqlrc, but I noticed the row count footer
> missing when it chooses ordinary output:

> Looks like the logic in printQuery() needs further treatment.

Hmm, this looks a bit tricky, because at the time we add the footer we
don't yet know which output format will be used. I don't have a good
idea how to fix that at the moment.


From: Noah Misch <noah(at)leadboat(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql omits row count under "\x auto"
Date: 2012-04-27 19:05:41
Message-ID: 20120427190541.GA25553@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 26, 2012 at 09:25:25PM +0300, Peter Eisentraut wrote:
> On m??n, 2012-04-23 at 12:30 -0400, Noah Misch wrote:
> > I've been enjoying "\x auto" in .psqlrc, but I noticed the row count footer
> > missing when it chooses ordinary output:
>
> > Looks like the logic in printQuery() needs further treatment.
>
> Hmm, this looks a bit tricky, because at the time we add the footer we
> don't yet know which output format will be used. I don't have a good
> idea how to fix that at the moment.

I fiddled with this and settled on moving the default_footer boolean setting
and the interpretation thereof down from the printQuery() level to the
printTable() level. That permits delaying the decision until we determine
whether the final output format is indeed vertical.

Attachment Content-Type Size
expanded-auto-rowcount-v1.patch text/plain 11.1 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql omits row count under "\x auto"
Date: 2012-05-01 21:26:37
Message-ID: CA+TgmoYxeeOQMFg6e6Q1pByoehqb8PkzXrTjwY7wmtCSy0eNGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Apr 27, 2012 at 3:05 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> On Thu, Apr 26, 2012 at 09:25:25PM +0300, Peter Eisentraut wrote:
>> On m??n, 2012-04-23 at 12:30 -0400, Noah Misch wrote:
>> > I've been enjoying "\x auto" in .psqlrc, but I noticed the row count footer
>> > missing when it chooses ordinary output:
>>
>> > Looks like the logic in printQuery() needs further treatment.
>>
>> Hmm, this looks a bit tricky, because at the time we add the footer we
>> don't yet know which output format will be used.  I don't have a good
>> idea how to fix that at the moment.
>
> I fiddled with this and settled on moving the default_footer boolean setting
> and the interpretation thereof down from the printQuery() level to the
> printTable() level.  That permits delaying the decision until we determine
> whether the final output format is indeed vertical.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company