Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tatsuro Yamada <yamada(dot)tatsuro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS
Date: 2018-12-19 05:27:05
Message-ID: 20181219052705.GD19856@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-12-19 05:45:29 Re: plpgsql plugin - stmt_beg/end is not called for top level block of statements
Previous Message Michael Paquier 2018-12-19 05:05:30 Re: [PATCH] Improve tab completion for CREATE TABLE