Thread: psql tab-complete: schema support, quotes, etc.

psql tab-complete: schema support, quotes, etc.

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Added support for schemas and quotes in tab-complete.c, as well as
a few other things:

* Made all references to the pg_* tables absolute, by specifying
  the pg_catalog schema.

* Added SCHEMA as a create/delete completion option.

* Added SCHEMA completion as: SELECT nspname FROM pg_catalog.pg_namespace
  WHERE substr(nspname,1,%d)='%s'

* Added completion of "INSERT INTO <table> (" with attribute names.

* Added completion of "INSERT INTO <table> (attribs)" with
  VALUES or SELECT

* Added limited locking completion: only for one table:
  "LOCK" and "LOCK TABLE" now both get a completion list of tables
  Complete with "IN" for LOCK [TABLE] <table>
  Complete LOCK [TABLE] <table> IN with a lock mode

* Added a very simple WHERE finisher that uses the previous word
  as a table lookup for attributes.

* Added quote support when parsing "previous words". In other words,
  hitting tab after INSERT INTO "foo bar baby"
  now does the right thing and recognizes "foo bar baby" as one word.

Letting tab-complete quote things that should be quoted seems to be
temporarily ifdef'ed out due to readline compatibility problems.
Can anyone elaborate on this?

Greg Sabino Mullane  greg@turnstep.com
PGP Key: 0x14964AC8 200207222050

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE9PKkWvJuQZxSWSsgRAiwZAJ9bNO0qCw1v7evsLmkV00zE4B2I/QCePYzk
6bUQZru8Gj+2S5wPbsPrQio=
=id1t
-----END PGP SIGNATURE-----


Attachment

Re: psql tab-complete: schema support, quotes, etc.

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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


Greg Sabino Mullane wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Added support for schemas and quotes in tab-complete.c, as well as
> a few other things:
>
> * Made all references to the pg_* tables absolute, by specifying
>   the pg_catalog schema.
>
> * Added SCHEMA as a create/delete completion option.
>
> * Added SCHEMA completion as: SELECT nspname FROM pg_catalog.pg_namespace
>   WHERE substr(nspname,1,%d)='%s'
>
> * Added completion of "INSERT INTO <table> (" with attribute names.
>
> * Added completion of "INSERT INTO <table> (attribs)" with
>   VALUES or SELECT
>
> * Added limited locking completion: only for one table:
>   "LOCK" and "LOCK TABLE" now both get a completion list of tables
>   Complete with "IN" for LOCK [TABLE] <table>
>   Complete LOCK [TABLE] <table> IN with a lock mode
>
> * Added a very simple WHERE finisher that uses the previous word
>   as a table lookup for attributes.
>
> * Added quote support when parsing "previous words". In other words,
>   hitting tab after INSERT INTO "foo bar baby"
>   now does the right thing and recognizes "foo bar baby" as one word.
>
> Letting tab-complete quote things that should be quoted seems to be
> temporarily ifdef'ed out due to readline compatibility problems.
> Can anyone elaborate on this?
>
> Greg Sabino Mullane  greg@turnstep.com
> PGP Key: 0x14964AC8 200207222050
>
> -----BEGIN PGP SIGNATURE-----
> Comment: http://www.turnstep.com/pgp.html
>
> iD8DBQE9PKkWvJuQZxSWSsgRAiwZAJ9bNO0qCw1v7evsLmkV00zE4B2I/QCePYzk
> 6bUQZru8Gj+2S5wPbsPrQio=
> =id1t
> -----END PGP SIGNATURE-----
>

[ Attachment, skipping... ]

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

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: psql tab-complete: schema support, quotes, etc.

From
Bruce Momjian
Date:
Patch applied.  Thanks.

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


Greg Sabino Mullane wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Added support for schemas and quotes in tab-complete.c, as well as
> a few other things:
>
> * Made all references to the pg_* tables absolute, by specifying
>   the pg_catalog schema.
>
> * Added SCHEMA as a create/delete completion option.
>
> * Added SCHEMA completion as: SELECT nspname FROM pg_catalog.pg_namespace
>   WHERE substr(nspname,1,%d)='%s'
>
> * Added completion of "INSERT INTO <table> (" with attribute names.
>
> * Added completion of "INSERT INTO <table> (attribs)" with
>   VALUES or SELECT
>
> * Added limited locking completion: only for one table:
>   "LOCK" and "LOCK TABLE" now both get a completion list of tables
>   Complete with "IN" for LOCK [TABLE] <table>
>   Complete LOCK [TABLE] <table> IN with a lock mode
>
> * Added a very simple WHERE finisher that uses the previous word
>   as a table lookup for attributes.
>
> * Added quote support when parsing "previous words". In other words,
>   hitting tab after INSERT INTO "foo bar baby"
>   now does the right thing and recognizes "foo bar baby" as one word.
>
> Letting tab-complete quote things that should be quoted seems to be
> temporarily ifdef'ed out due to readline compatibility problems.
> Can anyone elaborate on this?
>
> Greg Sabino Mullane  greg@turnstep.com
> PGP Key: 0x14964AC8 200207222050
>
> -----BEGIN PGP SIGNATURE-----
> Comment: http://www.turnstep.com/pgp.html
>
> iD8DBQE9PKkWvJuQZxSWSsgRAiwZAJ9bNO0qCw1v7evsLmkV00zE4B2I/QCePYzk
> 6bUQZru8Gj+2S5wPbsPrQio=
> =id1t
> -----END PGP SIGNATURE-----
>

[ Attachment, skipping... ]

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

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026