Thread

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

    D'Arcy Cain <darcy@druid.net> — 2017-01-27T15:16:31Z

    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@druid.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@Vex.Net, VoIP: sip:darcy@druid.net