Better psql tab-completion support for schemas and tables

Lists: pgsql-patches
From: Greg Sabino Mullane <greg(at)turnstep(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Better psql tab-completion support for schemas and tables
Date: 2007-10-21 19:33:16
Message-ID: 1192995196.10602.1.camel@greg-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

(oops, this time with -c, thanks Alvaro)

Full support for all schema and table name combinations when
getting a list of attributes. All of the following will now work:

select * from information_schema.columns where <tab>
select * from foo where <tab>
select * from "user" where <tab>
select * from "foo" where <tab>
select * from "Uppercase".lower where <tab>
select * from "gtsm.com"."foo.Bar" where <tab>
select * from "GTSM.com".foo where <tab>

Also applies to other places that get lists of columns: insert into,
alter table, create index, etc.

--
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200710211532
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

Attachment Content-Type Size
tabcomplete_schema_table.patch text/x-patch 11.1 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Better psql tab-completion support for schemas and tables
Date: 2007-11-05 17:17:56
Message-ID: 200711051717.lA5HHuM02469@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


This has been saved for the 8.4 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

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

Greg Sabino Mullane wrote:
> (oops, this time with -c, thanks Alvaro)
>
> Full support for all schema and table name combinations when
> getting a list of attributes. All of the following will now work:
>
> select * from information_schema.columns where <tab>
> select * from foo where <tab>
> select * from "user" where <tab>
> select * from "foo" where <tab>
> select * from "Uppercase".lower where <tab>
> select * from "gtsm.com"."foo.Bar" where <tab>
> select * from "GTSM.com".foo where <tab>
>
> Also applies to other places that get lists of columns: insert into,
> alter table, create index, etc.
>
> --
> Greg Sabino Mullane greg(at)turnstep(dot)com
> PGP Key: 0x14964AC8 200710211532
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: 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 <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Better psql tab-completion support for schemas and tables
Date: 2008-03-29 19:23:14
Message-ID: 19784.1206818594@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Greg Sabino Mullane <greg(at)turnstep(dot)com> writes:
> Full support for all schema and table name combinations when
> getting a list of attributes. All of the following will now work:

> select * from information_schema.columns where <tab>
> select * from foo where <tab>
> select * from "user" where <tab>
> select * from "foo" where <tab>
> select * from "Uppercase".lower where <tab>
> select * from "gtsm.com"."foo.Bar" where <tab>
> select * from "GTSM.com".foo where <tab>

Applied with minor revisions. I noticed while testing this that
although you fixed it for the case of the user having unnecessarily
quoted the preceding name, for example given a table foo,

update "foo" set <tab>

it's still not bright about letting you complete such an entry in the
first place -- try

update "f<tab>

That doesn't invalidate this patch, but there's still more work to do
on the completion queries.

regards, tom lane