Re: No longer possible to query catalogs for index capabilities? - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: No longer possible to query catalogs for index capabilities?
Date
Msg-id 87fuq9oo12.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: No longer possible to query catalogs for index capabilities?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: No longer possible to query catalogs for index capabilities?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
So I'm tidying up and doing docs for the next version of this patch, but
here for comment is the current functionality:

select cap,      pg_indexam_has_property(a.oid, cap) as "AM",      pg_index_has_property('onek_hundred'::regclass, cap)
as"Index",      pg_index_column_has_property('onek_hundred'::regclass, 1, cap) as "Column" from pg_am a,
unnest(array['asc','desc', 'nulls_first', 'nulls_last',                   'orderable', 'distance_orderable',
'can_order',                  'can_unique', 'can_multi_col', 'can_exclude',                   'can_backward',
'can_cluster','index_scan',                   'bitmap_scan', 'can_return', 'search_array',
'search_nulls'])       with ordinality as u(cap,ord)where a.amname='btree'order by ord;       cap         | AM | Index
|Column 
 
--------------------+----+-------+--------asc                |    |       | tdesc               |    |       |
fnulls_first       |    |       | fnulls_last         |    |       | torderable          |    |       |
tdistance_orderable|    |       | fcan_order          | t  | t     | tcan_unique         | t  | t     | tcan_multi_col
   | t  | t     | tcan_exclude        | t  | t     | tcan_backward       |    | t     | tcan_cluster        |    | t
| tindex_scan         |    | t     | tbitmap_scan        |    | t     | tcan_return         |    |       |
tsearch_array      |    |       | tsearch_nulls       |    |       | t
 
(17 rows)

This table shows what properties are exposed at the AM-wide level, the
per-index level and the per-column level.

distance_orderable now returns true/false depending on the opclass, not
just on the amcanorderbyop field. In order to do this, I've added an
optional amproperty function to the AM api, which if it exists, gets
first dibs on all property calls so it can override the result as it
sees fit.

can_return likewise reflects the result of index_can_return.

-- 
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Add hint for function named "is"
Next
From: Tom Lane
Date:
Subject: Re: Add hint for function named "is"