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

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tatsuro Yamada <yamada(dot)tatsuro(at)lab(dot)ntt(dot)co(dot)jp>, 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: 2019-01-25 11:09:27
Message-ID: 390d20e9-1267-8146-f517-36469f0b9907@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26/12/2018 07:07, Tatsuro Yamada wrote:
> +#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 "

This needs a bit of refinement. You need to handle quoted index names
(see nearby Query_for_list_of_attributes), and you should also complete
partial numbers (e.g., if I type 1 then complete 10, 11, ... if
appropriate).

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-01-25 11:33:07 postgres_fdw: estimate_path_cost_size fails to re-use cached costs
Previous Message Peter Eisentraut 2019-01-25 10:44:43 Re: Implicit timezone conversion replicating from timestamp to timestamptz?