Re: psql / tab-completion.c : patch proposals

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ian Barwick <barwick(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: psql / tab-completion.c : patch proposals
Date: 2003-03-27 16:45:05
Message-ID: 200303271645.h2RGj5U24497@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Patch applied. Thanks.

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

Ian Barwick wrote:
> Attached are two patches for psql's tab-completion.c.
>
> The first cleans up a couple of minor errors and ommissions
> and adds tab completion support to more slash commands, e.g.
> \dv.
>
> The second is an attempt to add tab completion for schemas
> and fully qualified relation names (e.g. public.mytable ).
> I think this covers the TODO-item:
> "Allow psql to do table completion for SELECT * FROM schema_part and table
> completion for SELECT * FROM schema_name."
>
> This happens via union selects querying:
> - relation_name in current search path;
> - schema_name;
> - schema.relation_name
> matching the current input string.
>
> E.g:
> SELECT p[TAB]
> will produce a list of all appropriate relation names in the current search
> path which begin with 'p', and also all schema names which begin with 'p';
> \d pub[TAB]
> will produce any relation names in the current search path and also
> any schema names beginning with 'pub';
> \d public.[TAB]
> will produce a list of all relations in the schema 'public';
> \d public.my[TAB]
> produces all relation names beginning with 'my' in schema 'public'.
>
> It seems to work for me; comments, suggestions, particularly regarding
> the coding and queries, are very welcome.
>
> Note that tables, indexes, views and sequences relations in the
> 'pg_catalog' namespace are excluded even though they are in
> the current search path. I found not doing this produced annoying behaviour
> when expanding names beginning with 'p'. People who work with system
> tables a lot may not like this though; I can look for another solution
> if necessary.
>
> The second patch must be applied after the first patch; it will not
> apply against CVS. Can supply one big patch but feel it more sensible
> to break up the changes into more digestible units.
>
>
> Ian Barwick
> barwick(at)gmx(dot)net

[ Attachment, skipping... ]

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-03-27 16:45:48 Re: Doc patch for func.sgml
Previous Message Bruce Momjian 2003-03-27 16:43:26 Re: Add CLUSTER ON to pg_dumps