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

From Peter Eisentraut
Subject Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS
Date
Msg-id 390d20e9-1267-8146-f517-36469f0b9907@2ndquadrant.com
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
List 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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Implicit timezone conversion replicating from timestamp totimestamptz?
Next
From: Etsuro Fujita
Date:
Subject: postgres_fdw: estimate_path_cost_size fails to re-use cached costs