Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS
От | Tatsuro Yamada |
---|---|
Тема | Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS |
Дата | |
Msg-id | e52059f6-8ef4-ca9d-d14c-1c980df4ddfb@lab.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS (Tatsuro Yamada <yamada.tatsuro@lab.ntt.co.jp>) |
Ответы |
Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS
|
Список | pgsql-hackers |
On 2018/12/26 14:50, Tatsuro Yamada wrote: > On 2018/12/26 14:15, Michael Paquier wrote: >> On Wed, Dec 26, 2018 at 02:05:26PM +0900, Tatsuro Yamada wrote: >>> Do you mean my "fix_manual_of_alter_index_v2.patch"? >> >> Nope. This patch is only a proposal for the documentation. The main >> patch to extend psql completion so as column numbers are suggested >> fails to apply. > > I rebased the WIP patch. :) > > * Following query is added to get attribute numbers of index, > however its result contains not only expression columns but also other columns. > > * I'm not sure what should I use "%d" and first "%s" in the query, so I commented out: /* %d %s */. > I know this is ugly.. Do you know how to use? > > +#define Query_for_list_of_attribute_numbers \ > +"SELECT attnum "\ > +" FROM pg_catalog.pg_attribute a, "\ > +" pg_catalog.pg_class c "\ > +" WHERE c.oid = a.attrelid "\ > +" AND a.attnum > 0 "\ > +" AND NOT a.attisdropped "\ > +" /* %d %s */" \ > +" AND a.attrelid = (select oid from pg_catalog.pg_class where relname = '%s') "\ > +" AND pg_catalog.pg_table_is_visible(c.oid) "\ > +"order by a.attnum asc " I modified the patch to remove unusable condition. ======== # create table hoge (a integer, b integer, c integer); # create index ind_hoge on hoge(a, b, c, (c*1), (c*2), (c*3), (c*4), (c*5), (c*6), (c*7), (c*8), (c*9)); # \d ind_hoge Index "public.ind_hoge" Column | Type | Key? | Definition --------+---------+------+------------ a | integer | yes | a b | integer | yes | b c | integer | yes | c expr | integer | yes | (c * 1) expr1 | integer | yes | (c * 2) expr2 | integer | yes | (c * 3) expr3 | integer | yes | (c * 4) expr4 | integer | yes | (c * 5) expr5 | integer | yes | (c * 6) expr6 | integer | yes | (c * 7) expr7 | integer | yes | (c * 8) expr8 | integer | yes | (c * 9) btree, for table "public.hoge" # alter index ind_hoge alter column <tab!> 1 10 11 12 2 3 4 5 6 7 8 9 # alter index ind_hoge alter column 1 <tab!> 1 10 11 12 # alter index ind_hoge alter column 10 <tab!> alter index ind_hoge alter COLUMN 10 SET STATISTICS ======== Thanks, Tatsuro Yamada
Вложения
В списке pgsql-hackers по дате отправления: