Fix psql tab completion for CREATE USER MAPPING.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 27 Jul 2017 18:13:15 +0000 (14:13 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 27 Jul 2017 18:13:15 +0000 (14:13 -0400)
After typing CREATE USER M..., it would not fill in MAPPING FOR,
even though that was clearly intended behavior.

Jeff Janes

Discussion: https://postgr.es/m/CAMkU=1wo2iQ6jWnN=egqOb5NxEPn0PpANEtKHr3uPooQ+nYPtw@mail.gmail.com

src/bin/psql/tab-complete.c

index e9fdc908c71de88b92726c4ed800b11bb0ebd384..e34922dd731cd6295c07b011ba900a3ebc641009 100644 (file)
@@ -1056,7 +1056,7 @@ static const pgsql_thing_t words_after_create[] = {
                                                             * INDEX ... */
    {"UNLOGGED", NULL, NULL, THING_NO_DROP | THING_NO_ALTER},   /* for CREATE UNLOGGED
                                                                 * TABLE ... */
-   {"USER", Query_for_list_of_roles},
+   {"USER", Query_for_list_of_roles " UNION SELECT 'MAPPING FOR'"},
    {"USER MAPPING FOR", NULL, NULL},
    {"VIEW", NULL, &Query_for_list_of_views},
    {NULL}                      /* end of list */