In psql tab completion, offer spelled-out commands not abbreviations.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 8 Sep 2021 17:21:42 +0000 (13:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 8 Sep 2021 17:21:42 +0000 (13:21 -0400)
Various psql backslash commands have both single-letter and long
forms, for example \e and \edit.  Previously, tab completion
generally offered the single-letter form but not the long form.
It seems more sensible to offer the long form, because (a) no
useful completion can happen when you've already typed the single
letter, and (b) if you're not so familiar with the command set
as to know that, the long form is likely to be less confusing.

Haiying Tang, reviewed by Dagfinn Ilmari MannsÃ¥ker and myself

Discussion: https://postgr.es/m/OS0PR01MB61136018064660F095CB57A8FB129@OS0PR01MB6113.jpnprd01.prod.outlook.com

src/bin/psql/tab-complete.c

index 75b867685a6524c318f452d4056eb571a03fb410..5cd583866896f55d64bdd3f1715950196a6d54f6 100644 (file)
@@ -1514,24 +1514,24 @@ psql_completion(const char *text, int start, int end)
                "\\des", "\\det", "\\deu", "\\dew", "\\dE", "\\df",
                "\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
                "\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\dP", "\\dPi", "\\dPt",
-               "\\drds", "\\dRs", "\\dRp", "\\ds", "\\dS",
+               "\\drds", "\\dRs", "\\dRp", "\\ds",
                "\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dX", "\\dy",
-               "\\e", "\\echo", "\\ef", "\\elif", "\\else", "\\encoding",
+               "\\echo", "\\edit", "\\ef", "\\elif", "\\else", "\\encoding",
                "\\endif", "\\errverbose", "\\ev",
                "\\f",
                "\\g", "\\gdesc", "\\gexec", "\\gset", "\\gx",
-               "\\h", "\\help", "\\H",
-               "\\i", "\\if", "\\ir",
-               "\\l", "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
-               "\\o",
-               "\\p", "\\password", "\\prompt", "\\pset",
-               "\\q", "\\qecho",
-               "\\r",
+               "\\help", "\\html",
+               "\\if", "\\include", "\\include_relative", "\\ir",
+               "\\list", "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
+               "\\out",
+               "\\password", "\\print", "\\prompt", "\\pset",
+               "\\qecho", "\\quit",
+               "\\reset",
                "\\s", "\\set", "\\setenv", "\\sf", "\\sv",
                "\\t", "\\T", "\\timing",
                "\\unset",
                "\\x",
-               "\\w", "\\warn", "\\watch",
+               "\\warn", "\\watch", "\\write",
                "\\z",
                "\\!", "\\?",
                NULL