Thread: psql omits row count under "\x auto"

psql omits row count under "\x auto"

From
Noah Misch
Date:
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


Re: psql omits row count under "\x auto"

From
Robert Haas
Date:
On Mon, Apr 23, 2012 at 12:30 PM, Noah Misch <noah@leadboat.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


Re: psql omits row count under "\x auto"

From
Noah Misch
Date:
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@leadboat.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.


Re: psql omits row count under "\x auto"

From
Peter Eisentraut
Date:
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.




Re: psql omits row count under "\x auto"

From
Noah Misch
Date:
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

Re: psql omits row count under "\x auto"

From
Robert Haas
Date:
On Fri, Apr 27, 2012 at 3:05 PM, Noah Misch <noah@leadboat.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