psql missing tab completion for extensions

Started by Magnus Haganderover 12 years ago5 messages
#1Magnus Hagander
magnus@hagander.net
1 attachment(s)

psql is missing tab completion for \dx (or more usfully, for \dx+).

Attached patch fixes this.

Do we consider this a bugfix and backpatch (at least to 9.3? even
though the problem goes back further), or head only?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

Attachments:

psql_extensions_complete.patchapplication/octet-stream; name=psql_extensions_complete.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 5b7fc93..b3de387 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -894,7 +894,7 @@ psql_completion(char *text, int start, int end)
 		"\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy", "\\copyright",
 		"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\dD", "\\des", "\\det", "\\deu", "\\dew", "\\df",
 		"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
-		"\\dn", "\\do", "\\dp", "\\drds", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv", "\\du",
+		"\\dn", "\\do", "\\dp", "\\drds", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv", "\\du", "\\dx",
 		"\\e", "\\echo", "\\ef", "\\encoding",
 		"\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l",
 		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
@@ -3320,6 +3320,8 @@ psql_completion(char *text, int start, int end)
 		COMPLETE_WITH_QUERY(Query_for_list_of_roles);
 	else if (strncmp(prev_wd, "\\dv", strlen("\\dv")) == 0)
 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_views, NULL);
+	else if (strncmp(prev_wd, "\\dx", strlen("\\dx")) == 0)
+		COMPLETE_WITH_QUERY(Query_for_list_of_extensions);
 	else if (strncmp(prev_wd, "\\dm", strlen("\\dm")) == 0)
 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);
 
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: psql missing tab completion for extensions

Magnus Hagander <magnus@hagander.net> writes:

psql is missing tab completion for \dx (or more usfully, for \dx+).
Attached patch fixes this.

Do we consider this a bugfix and backpatch (at least to 9.3? even
though the problem goes back further), or head only?

Sounds like a feature to me. I wouldn't object to sneaking it into
9.3 though.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Stephen Frost
sfrost@snowman.net
In reply to: Tom Lane (#2)
Re: psql missing tab completion for extensions

* Tom Lane (tgl@sss.pgh.pa.us) wrote:

Magnus Hagander <magnus@hagander.net> writes:

psql is missing tab completion for \dx (or more usfully, for \dx+).
Attached patch fixes this.

Do we consider this a bugfix and backpatch (at least to 9.3? even
though the problem goes back further), or head only?

Sounds like a feature to me. I wouldn't object to sneaking it into
9.3 though.

Agreed.

Thanks,

Stephen

#4Magnus Hagander
magnus@hagander.net
In reply to: Stephen Frost (#3)
Re: psql missing tab completion for extensions

On Thu, Aug 15, 2013 at 5:26 PM, Stephen Frost <sfrost@snowman.net> wrote:

* Tom Lane (tgl@sss.pgh.pa.us) wrote:

Magnus Hagander <magnus@hagander.net> writes:

psql is missing tab completion for \dx (or more usfully, for \dx+).
Attached patch fixes this.

Do we consider this a bugfix and backpatch (at least to 9.3? even
though the problem goes back further), or head only?

Sounds like a feature to me. I wouldn't object to sneaking it into
9.3 though.

Agreed.

Done.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Dimitri Fontaine
dimitri@2ndQuadrant.fr
In reply to: Magnus Hagander (#4)
Re: psql missing tab completion for extensions

Magnus Hagander <magnus@hagander.net> writes:

Magnus Hagander <magnus@hagander.net> writes:

psql is missing tab completion for \dx (or more usfully, for \dx+).
Attached patch fixes this.

Done.

Thanks!

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers