psql omits row count under "\x auto"

Started by Noah Mischalmost 14 years ago6 messageshackers
Jump to latest
#1Noah Misch
noah@leadboat.com

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

#2Robert Haas
robertmhaas@gmail.com
In reply to: Noah Misch (#1)
Re: psql omits row count under "\x auto"

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

#3Noah Misch
noah@leadboat.com
In reply to: Robert Haas (#2)
Re: psql omits row count under "\x auto"

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.

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Noah Misch (#1)
Re: psql omits row count under "\x auto"

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.

#5Noah Misch
noah@leadboat.com
In reply to: Peter Eisentraut (#4)
Re: psql omits row count under "\x auto"

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.

Attachments:

expanded-auto-rowcount-v1.patchtext/plain; charset=us-asciiDownload+79-49
#6Robert Haas
robertmhaas@gmail.com
In reply to: Noah Misch (#5)
Re: psql omits row count under "\x auto"

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