Re: Some bugs in psql_complete of psql
От | Kyotaro HORIGUCHI |
---|---|
Тема | Re: Some bugs in psql_complete of psql |
Дата | |
Msg-id | 20151222.184402.42713785.horiguchi.kyotaro@lab.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: Some bugs in psql_complete of psql (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>) |
Ответы |
Re: Some bugs in psql_complete of psql
(Peter Eisentraut <peter_e@gmx.net>)
|
Список | pgsql-hackers |
Hello, I returned to this since Thomas' psql-completion patch has been committed. This patch has been recreated on it. "IN TABLESPACE xxx OWNED BY" has been alredy fixed so I removed it. The attched files are the following, 1. 0001-Fix-tab-complete-of-CREATE-INDEX.patch Fixes completion for CREATE INDEX in ordinary way. 2. 0001-Fix-completion-for-CREATE-INDEX-type-2.patch An alternative for 1. Introduces multilevel matching. This effectively can avoid false matching, simplify each expressionand reduce the number of matching operations. 3. 0002-Fix-tab-completion-for-DROP-INDEX.patch Fix of DROP INDEX completion in the type-2 way. ===== At Tue, 08 Dec 2015 17:56:19 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote in <20151208.175619.245979824.horiguchi.kyotaro@lab.ntt.co.jp> > > I tested whether the following patterns work as expected or not. > > > > CREATE UNIQUE INDEX CONCURRENTLY name ON > > CREATE UNIQUE INDEX CONCURRENTLY ON > > CREATE UNIQUE INDEX name ON > > CREATE UNIQUE INDEX ON > > CREATE INDEX CONCURRENTLY name ON > > CREATE INDEX CONCURRENTLY ON > > CREATE INDEX name ON > > CREATE INDEX ON > > > > Then I found the following problems. > > > > "CREATE UNIQUE INDEX CONCURRENTLY <tab>" didn't suggest "ON". > > "CREATE UNIQUE INDEX ON <tab>" suggested nothing. > > "CREATE INDEX ON <tab>" suggested nothing. All of the cases above are completed correctly. As a new feature, this patch allows "IF NOT EXISTS". As the result, the following part of the syntax of CREATE INDEX is completed correctly. CREATE [UNIQUE] INDEX [CONCURRENTLY] [[IF NOT EXISTS] iname] ON tname > > "CREATE INDEX CONCURRENTLY <tab>" didn't suggest "ON". Now it suggests "ON", "IF NOT EXISTS" and existing index names. > > BTW, I found that tab-completion for DROP INDEX has the following problems. > > > > "DROP INDEX <tab>" didn't suggest "CONCURRENTLY". > > "DROP INDEX CONCURRENTLY name <tab>" suggested nothing. They are completed by the "things" completion. The first patch gives a wrong suggestion for DROP INDEX CONCURRENTLY with "IF NOT EXISTS". This can be avoided adding HeadMatches to every matching for "CREATE INDEX..." syntexes but it is too bothersome. Instaed, in the second alternative patch, I enclosed the whole "CREATE INDEX" stuff by an if(HeadMatches2("CREATE", "UNIQUE|INDEX")) block to avoid the false match and simplify each matching expression. As a side effect, the total number of the executions of matching expressions can be reduced. (This wouldn't be just a bug fix, but rarther a kind of refactoring.) The third patch fixes the behavior for DROP INDEX in this way. Thoughs? Suggestions? regards, -- Kyotaro Horiguchi NTT Open Source Software Center
В списке pgsql-hackers по дате отправления:
Следующее
От: Pavel StehuleДата:
Сообщение: Re: custom function for converting human readable sizes to bytes