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

From: Tatsuro Yamada <yamada(dot)tatsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Michael Paquier <michael(at)paquier(dot)xyz>
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-26 05:50:26
Message-ID: 69d58747-d02f-33f9-22a5-3dfa9d213935@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 "

Thanks,
Tatsuro Yamada

Attachment Content-Type Size
psql-tab-alter-column-colnumber-wip2.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-12-26 05:56:47 Re: Control your disk usage in PG: Introduction to Disk Quota Extension
Previous Message Michael Paquier 2018-12-26 05:42:55 Re: Allow auto_explain to log to NOTICE