Обсуждение: A bug of psql completion

Поиск
Список
Период
Сортировка

A bug of psql completion

От
Kyotaro HORIGUCHI
Дата:
Hello.

I noticed that the psql completion code for "ALTER TABLE x ALTER
[COLUMN] x DROP" is wrong. It works as the following

=# alter table x alter x drop <tab>
[nothing suggested]
=# alter table x table x alter x drop <tab>
DEFAULT   NOT NULL  

The attached patch fixes it.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index b556c00..6aa3f20 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1804,7 +1804,7 @@ psql_completion(const char *text, int start, int end)        COMPLETE_WITH_LIST4("PLAIN",
"EXTERNAL","EXTENDED", "MAIN");    /* ALTER TABLE ALTER [COLUMN] <foo> DROP */    else if (Matches7("ALTER", "TABLE",
MatchAny,"ALTER", "COLUMN", MatchAny, "DROP") ||
 
-             Matches8("ALTER", "TABLE", MatchAny, "TABLE", MatchAny, "ALTER", MatchAny, "DROP"))
+             Matches6("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "DROP"))        COMPLETE_WITH_LIST2("DEFAULT",
"NOTNULL");    else if (Matches4("ALTER", "TABLE", MatchAny, "CLUSTER"))        COMPLETE_WITH_CONST("ON"); 

Re: A bug of psql completion

От
Tom Lane
Дата:
Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> I noticed that the psql completion code for "ALTER TABLE x ALTER
> [COLUMN] x DROP" is wrong. It works as the following

> =# alter table x alter x drop <tab>
> [nothing suggested]
> =# alter table x table x alter x drop <tab>
> DEFAULT   NOT NULL  

> The attached patch fixes it.

Pushed, thanks.
        regards, tom lane



Re: A bug of psql completion

От
Kyotaro HORIGUCHI
Дата:
At Mon, 28 Nov 2016 11:52:07 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote in <4624.1480351927@sss.pgh.pa.us>
tgl> Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
tgl> > I noticed that the psql completion code for "ALTER TABLE x ALTER
tgl> > [COLUMN] x DROP" is wrong. It works as the following
...
tgl> > The attached patch fixes it.
tgl> 
tgl> Pushed, thanks.

Thanks for committing.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center