Add missing NULL terminator to list_SECURITY_LABEL_preposition[].
authorTom Lane
Mon, 14 Mar 2016 15:31:22 +0000 (11:31 -0400)
committerTom Lane
Mon, 14 Mar 2016 15:31:34 +0000 (11:31 -0400)
On the machines I tried this on, pressing TAB after SECURITY LABEL led to
being offered ON and FOR as intended, plus random other keywords (varying
across machines).  But if you were a bit more unlucky you'd get a crash,
as reported by [email protected] in bug #14019.

Seems to have been an aboriginal error in the SECURITY LABEL patch,
commit 4d355a8336e0f226.  Hence, back-patch to all supported versions.
There's no bug in HEAD, though, thanks to our recent tab-completion
rewrite.

src/bin/psql/tab-complete.c

index 69d94fc6b989b352f546d0a07b5ef4ff839343c1..28a0bb291ce714e9eae4f8823c8937b1d1950685 100644 (file)
@@ -3084,7 +3084,7 @@ psql_completion(const char *text, int start, int end)
             pg_strcasecmp(prev_wd, "LABEL") == 0)
    {
        static const char *const list_SECURITY_LABEL_preposition[] =
-       {"ON", "FOR"};
+           {"ON", "FOR", NULL};
 
        COMPLETE_WITH_LIST(list_SECURITY_LABEL_preposition);
    }