Some bugs in psql_complete of psql
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.
- Fix completion for ALL IN TABLESPACE OWNED BY.
- Fix the assumed syntax of CREATE INDEX where the CONCURRENTLY
is misplaced. (It is assuming the order "CREATE INDEX sth
CONCURRENTLY")
- Provide missing terminating NULL to the preposition list for
SECURITY LABEL.
- Add the preposition list with some missing items. However, this
would not be a kind of bug in constrast to the three items
above, though. This applied back to 9.3 and 9.2 doesn't have
"EVENT TRIGGER" and "MATERIALIZED VIEW" and 9.1 additionally
doesn't have "DATABASE" and "ROLE". I'll provide individual
patches if necessary.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachments:
0001-Fix-some-tab-completino-bugs.patchtext/x-patch; charset=us-asciiDownload
>From 36096e1afdda3f54800c2c73fe4f058a3eef25ef Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Mon, 2 Nov 2015 14:10:53 +0900
Subject: [PATCH] Fix some tab-completino bugs.
- 'ALTER [TABLE|xx] xxx ALL IN TABLE SPACE xx OWNED BY' cannot be completed.
- CONCURRENTLY in CREATE INDEX is misplaced.
- Preposition list of SECURITY LABEL is not terminated.
- The target list of SECURITY LABEL ON misses some alternatives.
---
src/bin/psql/tab-complete.c | 54 ++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 0e8d395..912811d 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1040,7 +1040,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev5_wd, "IN") == 0 &&
pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
pg_strcasecmp(prev2_wd, "OWNED") == 0 &&
- pg_strcasecmp(prev4_wd, "BY") == 0)
+ pg_strcasecmp(prev_wd, "BY") == 0)
{
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
}
@@ -2320,35 +2320,34 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
" UNION SELECT 'ON'"
" UNION SELECT 'CONCURRENTLY'");
+ /* 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);
/* Complete ... INDEX [<name>] ON with a list of tables */
else if ((pg_strcasecmp(prev3_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev2_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev2_wd, "CONCURRENTLY") == 0) &&
+ (pg_strcasecmp(prev4_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev3_wd, "CONCURRENTLY") == 0)) &&
pg_strcasecmp(prev_wd, "ON") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
- /* 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)
+ /* 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) ||
+ ((pg_strcasecmp(prev4_wd, "CREATE") == 0 ||
+ pg_strcasecmp(prev4_wd, "UNIQUE") == 0) &&
+ pg_strcasecmp(prev3_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev2_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);
- }
/*
- * Complete INDEX <name> ON <table> with a list of table columns (which
- * should really be in parens)
+ * Complete INDEX [CONCURRENTLY] <name> ON <table> with a list of table
+ * columns (which should really be in parens)
*/
else if ((pg_strcasecmp(prev4_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev3_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev3_wd, "CONCURRENTLY") == 0) &&
+ (pg_strcasecmp(prev5_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev4_wd, "CONCURRENTLY") == 0)) &&
pg_strcasecmp(prev2_wd, "ON") == 0)
{
static const char *const list_CREATE_INDEX2[] =
@@ -2357,8 +2356,8 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_CREATE_INDEX2);
}
else if ((pg_strcasecmp(prev5_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev4_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev4_wd, "CONCURRENTLY") == 0) &&
+ (pg_strcasecmp(prev6_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev5_wd, "CONCURRENTLY") == 0)) &&
pg_strcasecmp(prev3_wd, "ON") == 0 &&
pg_strcasecmp(prev_wd, "(") == 0)
COMPLETE_WITH_ATTR(prev2_wd, "");
@@ -3555,7 +3554,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev_wd, "LABEL") == 0)
{
static const char *const list_SECURITY_LABEL_preposition[] =
- {"ON", "FOR"};
+ {"ON", "FOR", NULL};
COMPLETE_WITH_LIST(list_SECURITY_LABEL_preposition);
}
@@ -3572,9 +3571,10 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev_wd, "ON") == 0))
{
static const char *const list_SECURITY_LABEL[] =
- {"LANGUAGE", "SCHEMA", "SEQUENCE", "TABLE", "TYPE", "VIEW",
- "MATERIALIZED VIEW", "COLUMN", "AGGREGATE", "FUNCTION", "DOMAIN",
- "LARGE OBJECT", NULL};
+ {"TABLE", "COLUMN", "AGGREGATE", "DATABASE", "DOMAIN",
+ "EVENT TRIGGER", "FOREIGN TABLE", "FUNCTION", "LARGE OBJECT",
+ "MATERIALIZED VIEW", "LANGUAGE", "ROLE", "SCHEMA",
+ "SEQUENCE", "TYPE", "VIEW", NULL};
COMPLETE_WITH_LIST(list_SECURITY_LABEL);
}
--
1.8.3.1
On Wed, Nov 4, 2015 at 5:27 PM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hello, thank you for the comments.
The revised version of this patch is attached.
- Prevent complete with ON to the sequence "[CREATE] [UNIQUE] INDEX ON".
- Added TABLESPACE to the preposition list for SECURITY LABEL.
I think that the current completion mechanism is simple, fast and
maybe enough but lacks of flexibility for optional items and
requires extra attention for false match.
At Fri, 6 Nov 2015 00:26:44 +0900, Fujii Masao <masao.fujii@gmail.com> wrote in <CAHGQGwHyyD2RTuaTSry6-Xu0Mjr4Vneifknn2jdgp43g+yjV8Q@mail.gmail.com>
On Wed, Nov 4, 2015 at 5:27 PM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.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".
No. Both for CREATE/DROP, their syntax is as follows ingoring
optional "IF [NOT] EXITS" and "UNIQUE". "ALTER INDEX" doesn't
take CONCURRENTLY.
DROP INDEX [CONCURRENTLY] name ...
CREATE INDEX [CONCURRENTLY] name ...
+ /* 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" ?
No. It intends to match the case where prev_wd is not
CONCURRENTLY but some name for the index to be created. As
writing this answer, I noticed that the index name is
optional. For such case, this completion rule completes with ON
after "INDEX ON". It should be fixed as the following.
+ 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 && + pg_strcasecmp(prev_wd, "ON") != 0) ||
The "CONCURRENTLY" case is matched by the condition after the
'||' at the tail in the codelet cited just above..
+ ((pg_strcasecmp(prev4_wd, "CREATE") == 0 ||
+ pg_strcasecmp(prev4_wd, "UNIQUE") == 0) &&
+ pg_strcasecmp(prev3_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev2_wd, "CONCURRENTLY") == 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?
Mmm... I don't understand what the patch attached to my first
mail is.. Yes, the list is missing TABLESPACE which exists in my
branch. It is surely contained in the revised patch.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachments:
0001-Fix-some-tab-completino-bugs-v2.patchtext/x-patch; charset=us-asciiDownload
>From 7b42a01556ef2ea2291e1d4748a9bf0f80046069 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Mon, 2 Nov 2015 14:10:53 +0900
Subject: [PATCH] Fix some tab-completino bugs.
- 'ALTER [TABLE|xx] xxx ALL IN TABLE SPACE xx OWNED BY' cannot be completed.
- CONCURRENTLY in CREATE INDEX is misplaced.
- Preposition list of SECURITY LABEL is not terminated.
- The target list of SECURITY LABEL ON misses some alternatives.
---
src/bin/psql/tab-complete.c | 55 +++++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 0e8d395..5a3930f 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1040,7 +1040,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev5_wd, "IN") == 0 &&
pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
pg_strcasecmp(prev2_wd, "OWNED") == 0 &&
- pg_strcasecmp(prev4_wd, "BY") == 0)
+ pg_strcasecmp(prev_wd, "BY") == 0)
{
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
}
@@ -2320,35 +2320,35 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
" UNION SELECT 'ON'"
" UNION SELECT 'CONCURRENTLY'");
+ /* 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);
/* Complete ... INDEX [<name>] ON with a list of tables */
else if ((pg_strcasecmp(prev3_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev2_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev2_wd, "CONCURRENTLY") == 0) &&
+ (pg_strcasecmp(prev4_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev3_wd, "CONCURRENTLY") == 0)) &&
pg_strcasecmp(prev_wd, "ON") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
- /* 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)
+ /* 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 &&
+ pg_strcasecmp(prev_wd, "ON") != 0) ||
+ ((pg_strcasecmp(prev4_wd, "CREATE") == 0 ||
+ pg_strcasecmp(prev4_wd, "UNIQUE") == 0) &&
+ pg_strcasecmp(prev3_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev2_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);
- }
/*
- * Complete INDEX <name> ON <table> with a list of table columns (which
- * should really be in parens)
+ * Complete INDEX [CONCURRENTLY] <name> ON <table> with a list of table
+ * columns (which should really be in parens)
*/
else if ((pg_strcasecmp(prev4_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev3_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev3_wd, "CONCURRENTLY") == 0) &&
+ (pg_strcasecmp(prev5_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev4_wd, "CONCURRENTLY") == 0)) &&
pg_strcasecmp(prev2_wd, "ON") == 0)
{
static const char *const list_CREATE_INDEX2[] =
@@ -2357,8 +2357,8 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_CREATE_INDEX2);
}
else if ((pg_strcasecmp(prev5_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev4_wd, "INDEX") == 0 ||
- pg_strcasecmp(prev4_wd, "CONCURRENTLY") == 0) &&
+ (pg_strcasecmp(prev6_wd, "INDEX") == 0 &&
+ pg_strcasecmp(prev5_wd, "CONCURRENTLY") == 0)) &&
pg_strcasecmp(prev3_wd, "ON") == 0 &&
pg_strcasecmp(prev_wd, "(") == 0)
COMPLETE_WITH_ATTR(prev2_wd, "");
@@ -3555,7 +3555,7 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev_wd, "LABEL") == 0)
{
static const char *const list_SECURITY_LABEL_preposition[] =
- {"ON", "FOR"};
+ {"ON", "FOR", NULL};
COMPLETE_WITH_LIST(list_SECURITY_LABEL_preposition);
}
@@ -3572,9 +3572,10 @@ psql_completion(const char *text, int start, int end)
pg_strcasecmp(prev_wd, "ON") == 0))
{
static const char *const list_SECURITY_LABEL[] =
- {"LANGUAGE", "SCHEMA", "SEQUENCE", "TABLE", "TYPE", "VIEW",
- "MATERIALIZED VIEW", "COLUMN", "AGGREGATE", "FUNCTION", "DOMAIN",
- "LARGE OBJECT", NULL};
+ {"TABLE", "COLUMN", "AGGREGATE", "DATABASE", "DOMAIN",
+ "EVENT TRIGGER", "FOREIGN TABLE", "FUNCTION", "LARGE OBJECT",
+ "MATERIALIZED VIEW", "LANGUAGE", "ROLE", "SCHEMA",
+ "SEQUENCE", "TABLESPACE", "TYPE", "VIEW", NULL};
COMPLETE_WITH_LIST(list_SECURITY_LABEL);
}
--
1.8.3.1
On Fri, Nov 6, 2015 at 11:27 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:
Hello, thank you for the comments.
The revised version of this patch is attached.
Thanks for updating the patch!
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 CONCURRENTLY <tab>" didn't suggest "ON".
"CREATE INDEX ON <tab>" suggested nothing.
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.
Regards,
--
Fujii Masao
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hello, thank you for reviewing.
# I injured at fingertip, It's quite nuisance and make me more
# slower to type in..
I posted another patch to totally refactor psql-complete so I
don't put revised patch of this for now but this discussion has
an importance for me so please continue to discuss on this a bit
more with me.
At Fri, 4 Dec 2015 22:39:08 +0900, Fujii Masao <masao.fujii@gmail.com> wrote in <CAHGQGwGB91SNyZWnLGEytRBx1Kbi0W2PO3NnH5QG0C2g6MmbdA@mail.gmail.com>
On Fri, Nov 6, 2015 at 11:27 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:Hello, thank you for the comments.
The revised version of this patch is attached.
Thanks for updating the patch!
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 ONThen I found the following problems.
"CREATE UNIQUE INDEX CONCURRENTLY <tab>" didn't suggest "ON".
This worked fine for me..
"CREATE UNIQUE INDEX ON <tab>" suggested nothing.
"CREATE INDEX ON <tab>" suggested nothing.
Oops... The comment for the entry says (tab-complete.c:2355 @
master).
| * Complete INDEX <name> ON <table> with a list of table columns (which
| * should really be in parens)
But it was *actually* a completion for "INDEX [CONCURRENTLY] ON
name" or "INDEX name ON" in doubtful way. I broke it by fixing it
so as to fit the comment. I saw the same kind of doubtfulness at
some place and this is one of the nuisance of the current
implement. I proposed to use regex-like minilanguage in another
thread. This enables write matching description by almost the
same format as what currently written as comments. What do you
think about this? (I'll post this later.)
/messages/by-id/20151126.144512.10228250.horiguchi.kyotaro@lab.ntt.co.jp
"CREATE INDEX CONCURRENTLY <tab>" didn't suggest "ON".
This is not suggested before this.
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.
Yeah, these are the same behavior with the current. We shall find
many instances of this kind of incompleteness of completion in
the current implelent. But the current way prohibits us from
enrich the completion in this direction, I believe.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/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 expression
and 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 ONThen 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
Attachments:
0001-Fix-tab-complete-of-CREATE-INDEX.patchtext/x-patch; charset=us-asciiDownload
>From 5488edb6ebdd253b1a10179ac119cc1588459791 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Tue, 22 Dec 2015 11:03:16 +0900
Subject: [PATCH] Fix tab-complete of CREATE INDEX
Completion for CREATE INDEX added CONCURRENLTY into wrong place, and
it didn't suggest "IF NOT EXISTS". This patch corrects and adds them.
---
src/bin/psql/tab-complete.c | 59 +++++++++++++++++++++++++++++++++------------
1 file changed, 43 insertions(+), 16 deletions(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 1a7d184..9f557b3 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1922,36 +1922,63 @@ psql_completion(const char *text, int start, int end)
else if (TailMatches2("CREATE|UNIQUE", "INDEX"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
" UNION SELECT 'ON'"
+ " UNION SELECT 'IF NOT EXISTS'"
" UNION SELECT 'CONCURRENTLY'");
- /* Complete ... INDEX [<name>] ON with a list of tables */
- else if (TailMatches3("INDEX", MatchAny, "ON") ||
- TailMatches2("INDEX|CONCURRENTLY", "ON"))
- COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
- /* If we have CREATE|UNIQUE INDEX <sth> CONCURRENTLY, then add "ON" */
- else if (TailMatches3("INDEX", MatchAny, "CONCURRENTLY") ||
- TailMatches2("INDEX", "CONCURRENTLY"))
+ /*
+ * If we have CREATE [UNIQUE] INDEX [CONCURRENTLY], suggest existing
+ * indexes or ON/IF NOT EXISTS.
+ */
+ else if (TailMatches2("INDEX", "CONCURRENTLY"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
+ " UNION SELECT 'ON'"
+ " UNION SELECT 'IF NOT EXISTS'");
+ /*
+ * If we have CREATE [UNIQUE] INDEX [CONCURRENTLY] IF NOT EXISTS, suggest
+ * existing indexes
+ */
+ else if (TailMatches4("INDEX|CONCURRENTLY", "IF", "NOT", "EXISTS"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
+ /*
+ * If we have CREATE [UNIQUE] INDEX [CONCURRENTLY] [IF NOT EXISTS sth],
+ * then add "ON"
+ */
+ else if (TailMatches5("INDEX|CONCURRENTLY",
+ "IF", "NOT", "EXISTS", MatchAny) ||
+ TailMatches2("INDEX|CONCURRENTLY", "!ON"))
COMPLETE_WITH_CONST("ON");
- /* If we have CREATE|UNIQUE INDEX <sth>, then add "ON" or "CONCURRENTLY" */
- else if (TailMatches3("CREATE|UNIQUE", "INDEX", MatchAny))
- COMPLETE_WITH_LIST2("CONCURRENTLY", "ON");
+
+ /* Complete ... INDEX [[IF NOT EXISTS] <name>] ON with a list of tables */
+ else if (TailMatches3("INDEX|CONCURRENTLY", MatchAny, "ON") ||
+ TailMatches2("INDEX|CONCURRENTLY", "ON") ||
+ TailMatches6("INDEX|CONCURRENTLY",
+ "IF", "NOT", "EXISTS", MatchAny, "ON"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
/*
* Complete INDEX <name> ON <table> with a list of table columns (which
* should really be in parens)
*/
- else if (TailMatches4("INDEX", MatchAny, "ON", MatchAny) ||
- TailMatches3("INDEX|CONCURRENTLY", "ON", MatchAny))
+ else if (TailMatches3("INDEX|CONCURRENTLY", "ON", MatchAny) ||
+ TailMatches4("INDEX|CONCURRENTLY", MatchAny, "ON", MatchAny) ||
+ TailMatches7("INDEX|CONCURRENTLY",
+ "IF", "NOT", "EXISTS", MatchAny, "ON", MatchAny))
COMPLETE_WITH_LIST2("(", "USING");
- else if (TailMatches5("INDEX", MatchAny, "ON", MatchAny, "(") ||
+ else if (TailMatches5("INDEX|CONCURRENTLY", MatchAny,
+ "ON", MatchAny, "(") ||
+ TailMatches8("INDEX|CONCURRENTLY", "IF", "NOT", "EXISTS", MatchAny,
+ "ON", MatchAny, "(") ||
TailMatches4("INDEX|CONCURRENTLY", "ON", MatchAny, "("))
COMPLETE_WITH_ATTR(prev2_wd, "");
/* same if you put in USING */
else if (TailMatches5("ON", MatchAny, "USING", MatchAny, "("))
COMPLETE_WITH_ATTR(prev4_wd, "");
/* Complete USING with an index method */
- else if (TailMatches6("INDEX", MatchAny, MatchAny, "ON", MatchAny, "USING") ||
- TailMatches5("INDEX", MatchAny, "ON", MatchAny, "USING") ||
- TailMatches4("INDEX", "ON", MatchAny, "USING"))
+ else if (TailMatches5("INDEX|CONCURRENTLY", MatchAny,
+ "ON", MatchAny, "USING") ||
+ TailMatches8("INDEX|CONCURRENTLY",
+ "IF", "NOT", "EXISTS", MatchAny,
+ "ON", MatchAny, "USING") ||
+ TailMatches4("INDEX|CONCURRENTLY", "ON", MatchAny, "USING"))
COMPLETE_WITH_QUERY(Query_for_list_of_access_methods);
else if (TailMatches4("ON", MatchAny, "USING", MatchAny) &&
!TailMatches6("POLICY", MatchAny, MatchAny, MatchAny, MatchAny, MatchAny) &&
--
1.8.3.1
0001-Fix-completion-for-CREATE-INDEX-type-2.patchtext/x-patch; charset=us-asciiDownload
>From ac65ecdc92fcae899d13b7b6df51211f6cc7e69d Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Tue, 22 Dec 2015 12:34:13 +0900
Subject: [PATCH 1/2] Fix completion for CREATE INDEX type 2.
This patch introduces multilevel matching for completion. This can
simplify individual matching and make it easier to avoid false
matching.
---
src/bin/psql/tab-complete.c | 103 ++++++++++++++++++++++++++++----------------
1 file changed, 65 insertions(+), 38 deletions(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 1a7d184..fb3833b 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1918,45 +1918,72 @@ psql_completion(const char *text, int start, int end)
/* First off we complete CREATE UNIQUE with "INDEX" */
else if (TailMatches2("CREATE", "UNIQUE"))
COMPLETE_WITH_CONST("INDEX");
- /* If we have CREATE|UNIQUE INDEX, then add "ON" and existing indexes */
- else if (TailMatches2("CREATE|UNIQUE", "INDEX"))
- COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
- " UNION SELECT 'ON'"
- " UNION SELECT 'CONCURRENTLY'");
- /* Complete ... INDEX [<name>] ON with a list of tables */
- else if (TailMatches3("INDEX", MatchAny, "ON") ||
- TailMatches2("INDEX|CONCURRENTLY", "ON"))
- COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
- /* If we have CREATE|UNIQUE INDEX <sth> CONCURRENTLY, then add "ON" */
- else if (TailMatches3("INDEX", MatchAny, "CONCURRENTLY") ||
- TailMatches2("INDEX", "CONCURRENTLY"))
- COMPLETE_WITH_CONST("ON");
- /* If we have CREATE|UNIQUE INDEX <sth>, then add "ON" or "CONCURRENTLY" */
- else if (TailMatches3("CREATE|UNIQUE", "INDEX", MatchAny))
- COMPLETE_WITH_LIST2("CONCURRENTLY", "ON");
- /*
- * Complete INDEX <name> ON <table> with a list of table columns (which
- * should really be in parens)
- */
- else if (TailMatches4("INDEX", MatchAny, "ON", MatchAny) ||
- TailMatches3("INDEX|CONCURRENTLY", "ON", MatchAny))
- COMPLETE_WITH_LIST2("(", "USING");
- else if (TailMatches5("INDEX", MatchAny, "ON", MatchAny, "(") ||
- TailMatches4("INDEX|CONCURRENTLY", "ON", MatchAny, "("))
- COMPLETE_WITH_ATTR(prev2_wd, "");
- /* same if you put in USING */
- else if (TailMatches5("ON", MatchAny, "USING", MatchAny, "("))
- COMPLETE_WITH_ATTR(prev4_wd, "");
- /* Complete USING with an index method */
- else if (TailMatches6("INDEX", MatchAny, MatchAny, "ON", MatchAny, "USING") ||
- TailMatches5("INDEX", MatchAny, "ON", MatchAny, "USING") ||
- TailMatches4("INDEX", "ON", MatchAny, "USING"))
- COMPLETE_WITH_QUERY(Query_for_list_of_access_methods);
- else if (TailMatches4("ON", MatchAny, "USING", MatchAny) &&
- !TailMatches6("POLICY", MatchAny, MatchAny, MatchAny, MatchAny, MatchAny) &&
- !TailMatches4("FOR", MatchAny, MatchAny, MatchAny))
- COMPLETE_WITH_CONST("(");
+ /* Completion for CREATE INDEX */
+ else if (HeadMatches2("CREATE", "UNIQUE|INDEX"))
+ {
+ /* If we have CREATE|UNIQUE INDEX, then add "ON" and existing indexes */
+ if (TailMatches1("INDEX"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
+ " UNION SELECT 'ON'"
+ " UNION SELECT 'IF NOT EXISTS'"
+ " UNION SELECT 'CONCURRENTLY'");
+ /*
+ * If we have CREATE [UNIQUE] INDEX [CONCURRENTLY], suggest existing
+ * indexes or ON/IF NOT EXISTS.
+ */
+ else if (TailMatches1("CONCURRENTLY"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
+ " UNION SELECT 'ON'"
+ " UNION SELECT 'IF NOT EXISTS'");
+ /*
+ * If we have CREATE [UNIQUE] INDEX [CONCURRENTLY] IF NOT EXISTS,
+ * suggest existing indexes
+ */
+ else if (TailMatches3("IF", "NOT", "EXISTS"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
+ /*
+ * If we have CREATE [UNIQUE] INDEX [CONCURRENTLY] [IF NOT EXISTS
+ * sth], then add "ON"
+ */
+ else if (TailMatches4("IF", "NOT", "EXISTS", MatchAny) ||
+ TailMatches2("INDEX|CONCURRENTLY", "!ON"))
+ COMPLETE_WITH_CONST("ON");
+
+ /*
+ * Complete ... INDEX [[IF NOT EXISTS] <name>] ON with a list of
+ * tables
+ */
+ else if (TailMatches3("INDEX|CONCURRENTLY", MatchAny, "ON") ||
+ TailMatches2("INDEX|CONCURRENTLY", "ON") ||
+ TailMatches5("IF", "NOT", "EXISTS", MatchAny, "ON"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tm, NULL);
+
+ /*
+ * Complete INDEX <name> ON <table> with a list of table columns
+ * (which should really be in parens)
+ */
+ else if (TailMatches3("INDEX|CONCURRENTLY", "ON", MatchAny) ||
+ TailMatches4("INDEX|CONCURRENTLY", MatchAny, "ON", MatchAny) ||
+ TailMatches6("IF", "NOT", "EXISTS", MatchAny, "ON", MatchAny))
+ COMPLETE_WITH_LIST2("(", "USING");
+ else if (TailMatches5("INDEX|CONCURRENTLY", MatchAny,
+ "ON", MatchAny, "(") ||
+ TailMatches7("IF", "NOT", "EXISTS", MatchAny,
+ "ON", MatchAny, "(") ||
+ TailMatches4("INDEX|CONCURRENTLY", "ON", MatchAny, "("))
+ COMPLETE_WITH_ATTR(prev2_wd, "");
+ /* same if you put in USING */
+ else if (TailMatches5("ON", MatchAny, "USING", MatchAny, "("))
+ COMPLETE_WITH_ATTR(prev4_wd, "");
+ /* Complete USING with an index method */
+ else if (TailMatches3("ON", MatchAny, "USING"))
+ COMPLETE_WITH_QUERY(Query_for_list_of_access_methods);
+ else if (TailMatches4("ON", MatchAny, "USING", MatchAny) &&
+ !TailMatches6("POLICY", MatchAny, MatchAny, MatchAny, MatchAny, MatchAny) &&
+ !TailMatches4("FOR", MatchAny, MatchAny, MatchAny))
+ COMPLETE_WITH_CONST("(");
+ } /* CREATE [UNIQUE] INDEX */
/* CREATE POLICY */
/* Complete "CREATE POLICY <name> ON" */
--
1.8.3.1
0002-Fix-tab-completion-for-DROP-INDEX.patchtext/x-patch; charset=us-asciiDownload
>From d3afe85dded940d67480f305aecb6ab9fb4f9503 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Tue, 22 Dec 2015 12:51:41 +0900
Subject: [PATCH 2/2] Fix tab completion for DROP INDEX
DROP INDEX didn't get suggestions of "CONCURRENTLY", or "IF
EXISTS". This patch introduces such suggestions.
---
src/bin/psql/tab-complete.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index fb3833b..45bee03 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2199,7 +2199,7 @@ psql_completion(const char *text, int start, int end)
/* DROP (when not the previous word) */
/* DROP object with CASCADE / RESTRICT */
else if (TailMatches3("DROP",
- "COLLATION|CONVERSION|DOMAIN|EXTENSION|INDEX|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
+ "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
MatchAny) ||
(TailMatches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
ends_with(prev_wd, ')')) ||
@@ -2217,6 +2217,22 @@ psql_completion(const char *text, int start, int end)
else if (TailMatches2("DROP", "FOREIGN"))
COMPLETE_WITH_LIST2("DATA WRAPPER", "TABLE");
+ /* DROP INDEX */
+ else if (HeadMatches2("DROP", "INDEX"))
+ {
+ if (TailMatches1("INDEX"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
+ " UNION SELECT 'IF EXISTS'"
+ " UNION SELECT 'CONCURRENTLY'");
+ else if (TailMatches1("CONCURRENTLY"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes,
+ " UNION SELECT 'IF EXISTS'");
+ else if (TailMatches2("IF", "EXISTS"))
+ COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
+ else
+ COMPLETE_WITH_LIST2("CASCADE", "RESTRICT");
+ }
+
/* DROP MATERIALIZED VIEW */
else if (TailMatches2("DROP", "MATERIALIZED"))
COMPLETE_WITH_CONST("VIEW");
--
1.8.3.1
On 12/22/15 4:44 AM, Kyotaro HORIGUCHI wrote:
1. 0001-Fix-tab-complete-of-CREATE-INDEX.patch
Fixes completion for CREATE INDEX in ordinary way.
This part has been fixed in another thread. Please check whether that
satisfies all your issues.
3. 0002-Fix-tab-completion-for-DROP-INDEX.patch
Fix of DROP INDEX completion in the type-2 way.
I agree that we could use completion support for DROP INDEX
CONCURRENTLY, but I would rather not throw IF NOT EXISTS into the same
patch. We don't have support for IF NOT EXISTS anywhere else. If you
think about, it's rather unnecessary, because tab completion will
determine for you whether an object exists.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 1/12/16 9:46 PM, Peter Eisentraut wrote:
On 12/22/15 4:44 AM, Kyotaro HORIGUCHI wrote:
1. 0001-Fix-tab-complete-of-CREATE-INDEX.patch
Fixes completion for CREATE INDEX in ordinary way.
This part has been fixed in another thread. Please check whether that
satisfies all your issues.3. 0002-Fix-tab-completion-for-DROP-INDEX.patch
Fix of DROP INDEX completion in the type-2 way.
I agree that we could use completion support for DROP INDEX
CONCURRENTLY, but I would rather not throw IF NOT EXISTS into the same
patch. We don't have support for IF NOT EXISTS anywhere else. If you
think about, it's rather unnecessary, because tab completion will
determine for you whether an object exists.
I have applied a reduced version of the DROP INDEX patch. I think that
covers everything in your submission, but please check.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Hello, thank you for committing this.
At Sat, 16 Jan 2016 21:09:26 -0500, Peter Eisentraut <peter_e@gmx.net> wrote in <569AF7D6.9090107@gmx.net>
On 1/12/16 9:46 PM, Peter Eisentraut wrote:
On 12/22/15 4:44 AM, Kyotaro HORIGUCHI wrote:
1. 0001-Fix-tab-complete-of-CREATE-INDEX.patch
Fixes completion for CREATE INDEX in ordinary way.
This part has been fixed in another thread. Please check whether that
satisfies all your issues.3. 0002-Fix-tab-completion-for-DROP-INDEX.patch
Fix of DROP INDEX completion in the type-2 way.
I agree that we could use completion support for DROP INDEX
CONCURRENTLY, but I would rather not throw IF NOT EXISTS into the same
patch. We don't have support for IF NOT EXISTS anywhere else. If you
think about, it's rather unnecessary, because tab completion will
determine for you whether an object exists.I have applied a reduced version of the DROP INDEX patch. I think that
covers everything in your submission, but please check.
I examined the commit 4189e3d659abb48d159a6c3faabaa7e99498ca3e
and it looks fine. I'll post another patch for IF (NOT) EXISTS
for all possible part later. Thank you Peter.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers