Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYHJJ-00061S-Jm for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Aug 2016 18:36:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bYHJJ-0003FE-14 for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Aug 2016 18:36:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bYHJG-0003DW-RJ for pgsql-hackers@postgresql.org; Fri, 12 Aug 2016 18:35:58 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bYHJE-0001Sv-3J for pgsql-hackers@postgresql.org; Fri, 12 Aug 2016 18:35:58 +0000 Received: from localhost ([127.0.0.1]:62995 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.84 (FreeBSD)) (envelope-from ) id 1bYHJA-000HL2-FF; Fri, 12 Aug 2016 18:35:52 +0000 From: Andrew Gierth To: Tom Lane Cc: Alvaro Herrera , Kevin Grittner , Stephen Frost , Peter Eisentraut , Robert Haas , "pgsql-hackers\@postgresql.org" Subject: Re: No longer possible to query catalogs for index capabilities? In-Reply-To: <30901.1470868017@sss.pgh.pa.us> (Tom Lane's message of "Wed, 10 Aug 2016 18:26:57 -0400") Message-ID: <87fuq9oo12.fsf@news-spur.riddles.org.uk> References: <20160809155623.GA567087@alvherre.pgsql> <87y445ap58.fsf@news-spur.riddles.org.uk> <87a8gkr8fu.fsf@news-spur.riddles.org.uk> <17563.1470843700@sss.pgh.pa.us> <8737mcr3vn.fsf@news-spur.riddles.org.uk> <30901.1470868017@sss.pgh.pa.us> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) Date: Fri, 12 Aug 2016 19:35:52 +0100 MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers