Incomplete description for \t in psql documentation - should mention caption

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Incomplete description for \t in psql documentation - should mention caption
Date: 2016-04-21 22:01:23
Message-ID: CAKFQuwanqNCLuw7e4BzBVvaVRnyhOP3_0vtTQ0UZvDzRw_9FGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

​​http://www.postgresql.org/docs/9.5/interactive/app-psql.html

"""
\t
Toggles the display of output column name headings and row count footer.
This command is equivalent to \pset tuples_only and is provided for
convenience.
"""

Experience says that a table caption (i.e., \C) is also suppressed when the
option is used.

The documentation should be changed though I'd argue that there is some
merit for still showing the caption.

The exact combination I wanted to try and make work was:
\C 'Table Caption'
\x \t
SELECT * FROM tbl LIMIT 1

The desired output would have been:

Table Caption
col1 | 1
col2 | 2
col3 | 3

This is also a bit mis-leading: the \t suppresses column name headings -
unless viewed in expanded mode...in which case it suppresses the "ROW#"
block heading but leave the column name headings (which just happen to be
placed in rows) in place. This is indeed the desired behavior it just
isn't precisely documented.

So:

\t
Toggles display of the row count footer. In normal mode also suppresses
the column name headings. In expanded mode suppresses the Record# block
header instead. Also suppresses any caption that is set for the table.

I'm not sure how willing someone is to work these mechanics out - or the
desire to make them conditional on expanded versus table mode. My
immediate needs can be readily solved by adding an additional column to my
output so that "type | Record Type" is the first column of the expanded
output. Or just live with the redundant "-[ RECORD 1 ]---------" header.

David J.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-04-21 22:48:42 Re: max_parallel_degree > 0 for 9.6 beta
Previous Message Tom Lane 2016-04-21 21:15:24 Re: VS 2015 support in src/tools/msvc