Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS
Date
Msg-id 20181219052705.GD19856@paquier.xyz
Whole thread Raw
In response to Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS  (Tatsuro Yamada <yamada.tatsuro@lab.ntt.co.jp>)
Responses Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS  (Tatsuro Yamada <yamada.tatsuro@lab.ntt.co.jp>)
List pgsql-hackers
On Tue, Dec 04, 2018 at 02:31:51PM +0900, Tatsuro Yamada wrote:
>  - For now, there is no column_number column on "\d index_name" result.
>    So, if tab-completion suggested column_numbers, user can't match
>    these easily.

Well, it depends how many columns an index definition has.  If that's
only a few then it is not really a problem.  However I agree that we
could add that in the output of \d for indexes just before the
definition to help with an easy match.  The columns showing up are
relkind-dependent so that's not an issue.  This would create some noise
in some regression tests.

> So, we should better to vote to decide implementation of the tab-completion.
>
> Which is better to use either column_names or column_numbers?
> I'd like to hear opinions from others. :)

There has been a discussion in this area this week where the conclusion
is that we had better use column numbers rather than names arbitrarily
generated by the server for pg_dump:
https://postgr.es/m/CAARsnT3UQ4V=yDNW468w8RqHfYiY9mpn2r_c5UkBJ97NAApUEw@mail.gmail.com

So my take on the matter is to use column numbers, and show only those
with an expression as index attributes with no expressions cannot have
statistics.

Looking at the patches, fix_manual_of_alter_index.patch does not matter
much as the documentation of ALTER INDEX already mentions some
compatibilities with ALTER TABLE.

+       /* ALTER TABLE ALTER [COLUMN] <foo> SET STATISTICS */
+       else if (HeadMatches("ALTER", "TABLE") && TailMatches("SET", "STATISTICS")){
+               /* We don't complete after "SET STATISTICS" */
+       }
Okay, this one makes sense taken independently as the current completion
is confusing.  Could you also do the same for ALTER INDEX?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH] Improve tab completion for CREATE TABLE
Next
From: Michael Paquier
Date:
Subject: Re: plpgsql plugin - stmt_beg/end is not called for top level blockof statements