Re: No longer possible to query catalogs for index capabilities?

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Kevin Grittner <kgrittn(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers\(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: No longer possible to query catalogs for index capabilities?
Date: 2016-08-12 18:35:52
Message-ID: 87fuq9oo12.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 | | | t
desc | | | f
nulls_first | | | f
nulls_last | | | t
orderable | | | t
distance_orderable | | | f
can_order | t | t | t
can_unique | t | t | t
can_multi_col | t | t | t
can_exclude | t | t | t
can_backward | | t | t
can_cluster | | t | t
index_scan | | t | t
bitmap_scan | | t | t
can_return | | | t
search_array | | | t
search_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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-08-12 18:40:11 Re: Add hint for function named "is"
Previous Message Tom Lane 2016-08-12 18:05:55 Re: Add hint for function named "is"