@@ -583,6 +583,17 @@ static const SchemaQuery Query_for_list_of_statistics = {
583583" OR '\"' || relname || '\"'='%s') "\
584584" AND pg_catalog.pg_table_is_visible(c.oid)"
585585
586+ #define Query_for_list_of_attribute_numbers \
587+ "SELECT attnum "\
588+ " FROM pg_catalog.pg_attribute a, pg_catalog.pg_class c "\
589+ " WHERE c.oid = a.attrelid "\
590+ " AND a.attnum > 0 "\
591+ " AND NOT a.attisdropped "\
592+ " AND substring(attnum::pg_catalog.text,1,%d)='%s' "\
593+ " AND (pg_catalog.quote_ident(relname)='%s' "\
594+ " OR '\"' || relname || '\"'='%s') "\
595+ " AND pg_catalog.pg_table_is_visible(c.oid)"
596+
586597#define Query_for_list_of_attributes_with_schema \
587598"SELECT pg_catalog.quote_ident(attname) "\
588599" FROM pg_catalog.pg_attribute a, pg_catalog.pg_class c, pg_catalog.pg_namespace n "\
@@ -1604,6 +1615,12 @@ psql_completion(const char *text, int start, int end)
16041615 /* ALTER INDEX <name> ALTER */
16051616 else if (Matches ("ALTER" , "INDEX" , MatchAny , "ALTER" ))
16061617 COMPLETE_WITH ("COLUMN" );
1618+ /* ALTER INDEX <name> ALTER COLUMN */
1619+ else if (Matches ("ALTER" , "INDEX" , MatchAny , "ALTER" , "COLUMN" ))
1620+ {
1621+ completion_info_charp = prev3_wd ;
1622+ COMPLETE_WITH_QUERY (Query_for_list_of_attribute_numbers );
1623+ }
16071624 /* ALTER INDEX <name> ALTER COLUMN <colnum> */
16081625 else if (Matches ("ALTER" , "INDEX" , MatchAny , "ALTER" , "COLUMN" , MatchAny ))
16091626 COMPLETE_WITH ("SET STATISTICS" );
0 commit comments