From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Some bugs in psql_complete of psql |
Date: | 2015-11-05 15:26:44 |
Message-ID: | CAHGQGwHyyD2RTuaTSry6-Xu0Mjr4Vneifknn2jdgp43g+yjV8Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Nov 4, 2015 at 5:27 PM, Kyotaro HORIGUCHI
<horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Hello, I found that a typo(?) in tab-complete.c.
>
>> /* ALTER TABLE,INDEX,MATERIALIZED VIEW xxx ALL IN TABLESPACE xxx OWNED BY */
>> else if (pg_strcasecmp(prev6_wd, "ALL") == 0 &&
>> pg_strcasecmp(prev5_wd, "IN") == 0 &&
>> pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
>> pg_strcasecmp(prev2_wd, "OWNED") == 0 &&
>> pg_strcasecmp(prev4_wd, "BY") == 0)
>
> "BY" is compared against the word in wrong position and it
> prevents this completion from matching.
>
> I also found some other bugs in psql-completion. The attached
> patch applied on master and fixes them all togher.
+ /* If we have INDEX CONCURRENTLY <sth>, then add exiting indexes */
+ else if (pg_strcasecmp(prev2_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev_wd, "CONCURRENTLY") == 0)
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
Is this for DROP INDEX CONCURRENTLY case?
If yes, we should check that prev3_wd is "DROP".
+ /* If we have CREATE|UNIQUE INDEX [CONCURRENTLY] <sth>, then add "ON" */
+ else if (((pg_strcasecmp(prev3_wd, "CREATE") == 0 ||
+ pg_strcasecmp(prev3_wd, "UNIQUE") == 0) &&
+ pg_strcasecmp(prev2_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev_wd, "CONCURRENTLY") != 0) ||
The "!= 0" in the above last condition should be "== 0" ?
+ {"TABLE", "COLUMN", "AGGREGATE", "DATABASE", "DOMAIN",
+ "EVENT TRIGGER", "FOREIGN TABLE", "FUNCTION", "LARGE OBJECT",
+ "MATERIALIZED VIEW", "LANGUAGE", "ROLE", "SCHEMA",
+ "SEQUENCE", "TYPE", "VIEW", NULL};
TABLESPACE also should be added to the list?
Regards,
--
Fujii Masao
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2015-11-05 15:36:40 | Re: pgbench gaussian/exponential docs improvements |
Previous Message | Marko Tiikkaja | 2015-11-05 15:23:32 | Re: WIP: Fix parallel workers connection bug in pg_dump (Bug #13727) |