]> granicus.if.org Git - postgresql/commitdiff
Improve psql's tab completion for \l.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 18 Aug 2016 15:29:16 +0000 (11:29 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 18 Aug 2016 15:29:16 +0000 (11:29 -0400)
Offer a list of database names; formerly no help was offered.

Ian Barwick, reviewed by Gerdan Santos

Patch: <5724132E.1030804@2ndquadrant.com>

src/bin/psql/tab-complete.c

index d31fd25b8d878ced5f8a8d96174e50c374704e94..1345e4ed80344ed52aadd9190bc8138916a73b02 100644 (file)
@@ -3033,6 +3033,8 @@ psql_completion(const char *text, int start, int end)
                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"))