Hi all, psql's auto-complete support for COMMENT ON was missing support for a few object types:
1.) EXTENSION and PROCEDURAL LANGUAGE are now auto-complete candidates for COMMENT ON [TAB]. Lists of extensions and procedural languages should also be filled in when a user types COMMENT ON EXTENSION [TAB] COMMENT ON PROCEDURAL LANGUAGE [TAB] 2.) This part of tab-complete.c looked like a spurious leftover: *************** psql_completion(char *text, int start, i *** 1580,1592 **** COMPLETE_WITH_LIST(list_TRANS2); } else if ((pg_strcasecmp(prev4_wd, "COMMENT") == 0 && pg_strcasecmp(prev3_wd, "ON") == 0) || (pg_strcasecmp(prev6_wd, "COMMENT") == 0 && ! pg_strcasecmp(prev5_wd, "ON") == 0) || ! (pg_strcasecmp(prev5_wd, "ON") == 0 && ! pg_strcasecmp(prev4_wd, "TEXT") == 0 && ! pg_strcasecmp(prev3_wd, "SEARCH") == 0)) COMPLETE_WITH_CONST("IS"); Since we want these choices to be filled in for COMMENT ON TEXT SEARCH [TAB]: {"CONFIGURATION", "DICTIONARY", "PARSER", "TEMPLATE", NULL}; which were already being handled correctly in an above block. One piece that I gave up on trying to fix is the auto-completion for {OPERATOR, OPERATOR CLASS, OPERATOR FAMILY}, since getting it working correctly would be a real hassle. There's the trouble of whether to auto-complete operators for OPERATOR [TAB], or whether to fill in {CLASS, FAMILY} instead. Plus the auto-completes for 'USING index_method'. While wasting time on OPERATOR [TAB], I realized we're being a bit overeager with this bit: else if ((pg_strcasecmp(prev4_wd, "COMMENT") == 0 && pg_strcasecmp(prev3_wd, "ON") == 0) || (pg_strcasecmp(prev6_wd, "COMMENT") == 0 && pg_strcasecmp(prev5_wd, "ON") == 0)) COMPLETE_WITH_CONST("IS"); which will auto-complete e.g. COMMENT ON AGGREGATE avg [TAB] with 'IS', when instead we'd want the possible argument types to avg, or nothing at all. Same deal with a few other object types, but it's probably not worth worrying about (at least, I'm not worrying about it at the moment). Barring objections, I can add this patch to the CF. Josh
tab_complete.v1.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers