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

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

From
"David G. Johnston"
Date:
<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​​<a
href="http://www.postgresql.org/docs/9.5/interactive/app-psql.html">http://www.postgresql.org/docs/9.5/interactive/app-psql.html</a></div><div
class="gmail_default"style="font-family:arial,helvetica,sans-serif"><br /></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">"""</div><divclass="gmail_default"
style="font-family:arial,helvetica,sans-serif"><divclass="gmail_default">\t</div><div class="gmail_default">Toggles the
displayof output column name headings and row count footer. This command is equivalent to \pset tuples_only and is
providedfor convenience.</div></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">"""</div><divclass="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Experiencesays that a table caption (i.e., \C) is also suppressed when
theoption is used.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br /></div><div
class="gmail_default"style="font-family:arial,helvetica,sans-serif">The documentation should be changed though I'd
arguethat there is some merit for still showing the caption.</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Theexact combination I wanted to try and make work was:</div><div
class="gmail_default"style="font-family:arial,helvetica,sans-serif">\C 'Table Caption'</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">\x\t</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">SELECT* FROM tbl LIMIT 1</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Thedesired output would have been:</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">TableCaption</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">col1  | 1</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">col2  | 2</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">col3  | 3</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Thisis also a bit mis-leading: the \t suppresses column name headings -
unlessviewed in expanded mode...in which case it suppresses the "ROW#" block heading but leave the column name headings
(whichjust happen to be placed in rows) in place.  This is indeed the desired behavior it just isn't precisely
documented.</div><divclass="gmail_default" style="font-family:arial,helvetica,sans-serif"><br /></div><div
class="gmail_default"style="font-family:arial,helvetica,sans-serif">So:</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">\t</div><divclass="gmail_default"
style="font-family:arial,helvetica,sans-serif">Togglesdisplay of the row count footer.  In normal mode also suppresses
thecolumn name headings.  In expanded mode suppresses the Record# block header instead.  Also suppresses any caption
thatis set for the table.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br
/></div><divclass="gmail_default" style="font-family:arial,helvetica,sans-serif">I'm not sure how willing someone is to
workthese mechanics out - or the desire to make them conditional on expanded versus table mode.  My immediate needs can
bereadily solved by adding an additional column to my output so that "type | Record Type" is the first column of the
expandedoutput.  Or just live with the redundant "-[ RECORD 1 ]---------" header.</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">DavidJ.</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div></div>