]> granicus.if.org Git - postgresql/commitdiff
psql: Improve tab completion of WITH
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 10 Apr 2012 17:35:39 +0000 (20:35 +0300)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 10 Apr 2012 17:35:39 +0000 (20:35 +0300)
Only match when WITH is the first word, as WITH may appear in many
other contexts.

Josh Kupershmidt

src/bin/psql/tab-complete.c

index d113adff033c56db2ccd7cdef32e42aeb91bcfa7..00df2c6197b1805d9089dbc53dabb088afcad998 100644 (file)
@@ -2842,7 +2842,10 @@ psql_completion(char *text, int start, int end)
                COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
 
 /* WITH [RECURSIVE] */
-       else if (pg_strcasecmp(prev_wd, "WITH") == 0)
+       /* Only match when WITH is the first word, as WITH may appear in many other
+          contexts. */
+       else if (pg_strcasecmp(prev_wd, "WITH") == 0 &&
+                        prev2_wd[0] == '\0')
                COMPLETE_WITH_CONST("RECURSIVE");
 
 /* ANALYZE */