Re: One-shot expanded output in psql using \G

From: D'Arcy Cain <darcy(at)druid(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: One-shot expanded output in psql using \G
Date: 2017-01-27 15:16:31
Message-ID: 8b8068d9-b218-06c6-6b98-8d7f1a365449@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-01-27 10:05 AM, David Fetter wrote:
> On Fri, Jan 27, 2017 at 02:27:37PM +0100, Christoph Berg wrote:
>> 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.
>
> +1
>
> Your situation is familiar to me, and likely common among heavy users
> of psql.

I am a pretty heavy user of psql but I don't think that that would be so
helpful. I assume you mean a new option, let's call it "\X" the causes
the next query to be expanded. I type "\X" then a query. I realize
that I made a mistake and have to redo the query so I have to type "\X"
again. If I forget then I have to run the query yet again.

What would be useful for me is a control that causes every query to be
expanded if it returns exactly one row. Now I can do this:

SELECT * FROM table WHERE table_status = 1; % get a short list
SELECT * FROM table WHERE table_id = 123; % drill down to one ID

The first would give me a normal list and the second would give me an
expanded look at the one I want to see in detail.

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner.
IM: darcy(at)Vex(dot)Net, VoIP: sip:darcy(at)druid(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-01-27 15:26:09 Re: One-shot expanded output in psql using \G
Previous Message Tom Lane 2017-01-27 15:08:07 Re: BUG: pg_stat_statements query normalization issues with combined queries