Re: psql tab completion enhancements

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: psql tab completion enhancements
Date: 2006-02-12 07:26:28
Message-ID: 200602120726.k1C7QSG16657@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


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
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
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

Attachment Content-Type Size
unknown_filename text/plain 9.6 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-02-12 07:29:38 Re: parallel builds with dependencies
Previous Message Tom Lane 2006-02-12 07:04:21 Re: OS X shared memory documentation