Hi,
On 2018/11/26 11:05, Tatsuro Yamada wrote:
> Hi,
>
> Attached patches are following:
>
> * tab_completion_alter_index_set_statistics.patch
> - Add column name completion after ALTER COLUMN
> - Avoid schema completion after SET STATISTICS
>
> * fix_manual_of_alter_index.patch
> - ALTER INDEX ALTER COLUMN syntax is able to use not only
> column number but also column name. So, I fixed the manual.
>
> * tab_completion_alter_table_set_statistics.patch
> - Avoid schema completion after SET STATISTICS
I couldn't write patches details on previous email, so I write
more explanation for that on this email.
* tab_completion_alter_index_set_statistics.patch
=======
There are two problems. You can use these DDL before testing.
#create table hoge (a integer, b integer);
#create index ind_hoge on hoge (a, (a + b), (a * b));
1) Can't get column names
# alter index ind_hoge alter column <tab!><tab!>... but can't complete.
2) I expected column names for column numbers after "SET STATISTICS", but
tab-completion gave schema names
# alter index ind_hoge alter column expr SET STATISTICS <tab!>
information_schema. pg_catalog. pg_temp_1. pg_toast. pg_toast_temp_1. public.
Applied the patch:
1) We can get column names after "alter column".
# alter index ind_hoge alter column <tab!>
a expr expr1
2) Fix!
# alter index ind_hoge alter column expr SET STATISTICS <tab!>
=======
* fix_manual_of_alter_index_v2.patch (Attached on this email)
=======
https://www.postgresql.org/docs/devel/sql-alterindex.html
The patch fixes the syntax on above manual.
s/column_number/column_number \| column_name/
And also it adds an explanation for column_name.
Syntax of ALTER INDEX ALTER COLUMN SET STATISTICS on the manual is below:
ALTER INDEX [ IF EXISTS ] name ALTER [ COLUMN ] column_number
SET STATISTICS integer
But we can use not only column number but also column name like this:
# alter index ind_hoge alter column 2 SET STATISTICS 100;
ALTER INDEX
# alter index ind_hoge alter column expr SET STATISTICS 100;
ALTER INDEX
=======
* tab_completion_alter_table_set_statistics.patch
=======
For now, we can get schema name by tab-completion. It is not appropriate.
# alter table hoge alter column a set statistics <tab!>
information_schema. pg_catalog. pg_temp_1. pg_toast. pg_toast_temp_1. public.
Applied the patch:
# alter table hoge alter column a set statistics <tab!>
=======
Any feedback is welcome. :)
Thanks,
Tatsuro Yamada
NTT Open Source Software Center