Skip site navigation (1) Skip section navigation (2)

Re: psql tab completion enhancements

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: pgman(at)candle(dot)pha(dot)pa(dot)us
Cc: Joachim Wieland <joe(at)mcknight(dot)de>, pgsql-patches(at)postgresql(dot)org
Subject: Re: psql tab completion enhancements
Date: 2006-02-12 15:26:09
Message-ID: 200602121526.k1CFQ9Z28558@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
I found it was easier to concatenate the "UNION" at the macro call site,
rather than the macro body.  This eliminates the extra macro.  Patch
attached and applied.

---------------------------------------------------------------------------

pgman wrote:
> 
> Modified patch attached and applied.
> 
> Rather than create the lists in psql, I used UNION SELECT 'KEYWORD' to
> pass the keyword to the backend to be added to the query list.
> 
> This was already being done for schema names, and was easy and efficient
> to add.  My addition is even simpler because it just concatenates two
> adjacent strings.  If you have more modifications, please use this
> system.
> 
> If you find a macro that needs an 'addon', you can add it as a macro
> parameter to all calls and just use "" if you don't need it.  If any
> macro call uses a non-constant string, you have to make a new *_ADDON
> macro version.
> 
> ---------------------------------------------------------------------------
> 
> Joachim Wieland wrote:
> > Hi,
> > 
> > psql's tab completion has the following problem:
> > 
> > If we have the following syntax for example:
> > 
> > SET SESSION AUTHORIZATION <user>;
> > SET SESSION AUTHORIZATION DEFAULT;
> > 
> > After "SET SESSION AUTHORIZATION", the tab completion can offer a list of
> > roles or the string constant "DEFAULT". However it can't offer both because
> > it can't get a list of roles and add a string constant to this list.
> > 
> > The appended patch adds the functionality of lists that can be extended with
> > constants.
> > 
> > Then you get:
> > 
> > template1=# SET session AUTHORIZATION <tab>
> > DEFAULT  fred     joe      john
> > 
> > I did proof-of-concept examples to add a constant to a
> > 
> >  - list from a query
> >  - list from a schema query
> >  - list of table attributes
> > 
> > 
> > Joachim

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Responses

pgsql-patches by date

Next:From: Martijn van OosterhoutDate: 2006-02-12 15:44:05
Subject: Re: [HACKERS] Spaces in psql output (Was: FW: PGBuildfarm member snake Branch HEAD Status changed)
Previous:From: Simon RiggsDate: 2006-02-12 13:12:17
Subject: Re: Skipping VACUUM of indexes when no work required

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group