[HACKERS] One-shot expanded output in psql using \G - Mailing list pgsql-hackers

From Christoph Berg
Subject [HACKERS] One-shot expanded output in psql using \G
Date
Msg-id 20170127132737.6skslelaf4txs6iw@msg.credativ.de
Whole thread Raw
Responses Re: [HACKERS] One-shot expanded output in psql using \G  (Stephen Frost <sfrost@snowman.net>)
Re: [HACKERS] One-shot expanded output in psql using \G  (Christoph Berg <christoph.berg@credativ.de>)
Re: [HACKERS] One-shot expanded output in psql using \G  (David Fetter <david@fetter.org>)
Re: [HACKERS] One-shot expanded output in psql using \G  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-hackers
I frequently find myself in the situation that I want the "\x"
expanded output mode activated just for one query. There's little
wrong with typing "\x" and re-executing the query in that case, but
then I'm always annoyed that the expanded output is still active for
the next query after that.

"\x auto" is not a fix for the problem; I have set up the pager to use
"less -S" (non-wrapping) by default so I can scroll right/left through
the query result instead of having it spread over several terminal
lines.

A workaround is to submit queries using "\x\g\x", but that's ugly,
clutters the output with toggle messages, and will forget that "\x
auto" was set.

Mysql's CLI client is using \G for this purpose, and adding the very
same functionality to psql fits nicely into the set of existing
backslash commands: \g sends the query buffer, \G will do exactly the
same as \g (including parameters), but forces expanded output just for
this query.

The same idea was discussed back in 2008. Back then the outcome was
that "\x auto" was implemented, but I still think that \G is a useful
feature to have on its own, and several people in the thread seem to
have agreed back then.

Patch attached, I'll add it to the next commit fest.

Mit freundlichen Grüßen,
Christoph Berg
-- 
Senior Berater, Tel.: +49 2166 9901 187
credativ GmbH, HRB Mönchengladbach 12080, USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer
pgp fingerprint: 5C48 FE61 57F4 9179 5970  87C6 4C5A 6BAB 12D2 A7AE

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [HACKERS] Performance improvement for joins where outer side is unique
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] nodes.h - comments comment