From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: strange CREATE INDEX tab completion cases |
Date: | 2015-12-13 14:16:03 |
Message-ID: | CAB7nPqTqGgnbW1qTi=m5v4_cg=Pgy1f+F2gQ7kO7qpupVtUycA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Dec 12, 2015 at 11:17 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> These two tab completion pieces look strange to me:
>
> /* If we have CREATE|UNIQUE INDEX <sth> CONCURRENTLY, then add "ON" */
> else if ((pg_strcasecmp(prev3_wd, "INDEX") == 0 ||
> pg_strcasecmp(prev2_wd, "INDEX") == 0) &&
> pg_strcasecmp(prev_wd, "CONCURRENTLY") == 0)
> COMPLETE_WITH_CONST("ON");
> /* If we have CREATE|UNIQUE INDEX <sth>, then add "ON" or "CONCURRENTLY" */
> else if ((pg_strcasecmp(prev3_wd, "CREATE") == 0 ||
> pg_strcasecmp(prev3_wd, "UNIQUE") == 0) &&
> pg_strcasecmp(prev2_wd, "INDEX") == 0)
> {
> static const char *const list_CREATE_INDEX[] =
> {"CONCURRENTLY", "ON", NULL};
>
> COMPLETE_WITH_LIST(list_CREATE_INDEX);
> }
>
> They appear to support a syntax along the lines of
>
> CREATE INDEX name CONCURRENTLY
>
> which is not the actual syntax.
Yep. That's visibly a bug introduced by this commit:
commit: 37ec19a15ce452ee94f32ebc3d6a9a45868e82fd
author: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
date: Wed, 17 Feb 2010 04:09:40 +0000
Support new syntax and improve handling of parentheses in psql tab-completion.
The current implementation is missing a correct completion in a couple
of cases, among them:
-- Should be only ON
=# create index asd
CONCURRENTLY ON
-- should give list of table
=# create index CONCURRENTLY aaa on
-- Should give ON and list of existing indexes
=# create index concurrently
Please see the attached to address those things (and others) with
extra fixes for a couple of comments.
Regards,
--
Michael
Attachment | Content-Type | Size |
---|---|---|
20151213_psql_completion_index.patch | binary/octet-stream | 2.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2015-12-13 16:01:58 | Re: pg_stat_replication log positions vs base backups |
Previous Message | Amit Kapila | 2015-12-13 14:05:11 | Re: Move PinBuffer and UnpinBuffer to atomics |