Add tsearch tab completion support:
authorBruce Momjian <bruce@momjian.us>
Fri, 14 Sep 2007 04:25:24 +0000 (04:25 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 14 Sep 2007 04:25:24 +0000 (04:25 +0000)
commit5f192d3642c6efe01e51f5fb54e798c53751e775
treee6551051c0b67812b83a96cd6171c8eb8d3530cd
parente178010baaf5d0aa86551e955dc23c22af1322c0
Add tsearch tab completion support:

* adds a few missing words to some commands (like adding GIN as a valid
index type or OWNED BY for ALTER SEQUENCE,...)

* support for ALTER TABLE foo ENABLE/DISABLE REPLICA TRIGGER/RULE

* autocomplete CREATE DATABASE foo TEMPLATE (mostly done to prevent
conflicts with the TEMPLATE keyword for text search)

* support for ALTER/CREATE/DROP TEXT SEARCH as well as COMMENT ON TEXT
SEARCH and the corresponding psql backslash commands.
This proved a little more difficult than expected due to the fact that
words_after_create[] is used for two purposes - one is to provide a list
of words that follow immediatly after CREATE (or DROP) and the other
purpose is to use it for autocompleting anywhere in the statement if the
word in that struct is found with a query.
Since TEXT SEARCH CONFIGURATION|DICTIONARY|TEMPLATE|PARSER results in 3
words instead of one (as all the other words in that list are) I added a
flag to the struct to tell create_command_generator() to skip that entry
 for autocompleting immediatly after CREATE which feels like a dirty
hack (but that holds true for a lot of code in tab-complete.c).

Stefan Kaltenbrunner
src/bin/psql/tab-complete.c