From: Ian Barwick <ian@2ndquadrant.com>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: psql: tab completion for \l
Date: Sat, 30 Apr 2016 11:06:38 +0900
Message-ID: <5724132E.1030804@2ndquadrant.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hi
Evidently over the past 15 or so years I've never needed to type "\l <TAB>",
but when isolating a single database entry in a cluster with a lot more
databases than most I've encountered, was suprised to notice it didn't work.
Trivial patch attached, will add to next commitfest.
Regards
Ian Barwick
--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:psql-tab-complete-backslash-l.patch (text/plain, 682B) downloaddiff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.cnew file mode 100644index a62ffe6..a87b483
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
*************** psql_completion(const char *text, int st
*** 2994,2999 ****
--- 2994,3001 ----
COMPLETE_WITH_QUERY(Query_for_list_of_encodings);
else if (TailMatchesCS1("\\h") || TailMatchesCS1("\\help"))
COMPLETE_WITH_LIST(sql_commands);
+ else if (TailMatchesCS1("\\l*") && !TailMatchesCS1("\\lo_*"))+ COMPLETE_WITH_QUERY(Query_for_list_of_databases);
else if (TailMatchesCS1("\\password"))
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
else if (TailMatchesCS1("\\pset"))
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: ian@2ndquadrant.com
Subject: Re: psql: tab completion for \l
In-Reply-To: <5724132E.1030804@2ndquadrant.com>
References: <5724132E.1030804@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox