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 87a8gkr8fu.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: No longer possible to query catalogs for index capabilities?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: No longer possible to query catalogs for index capabilities?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Updated patch. Changes:

  - returns NULL rather than "cache lookup failed"

  - added pg_index_column_has_property (incl. docs)

  - added regression tests

Not changed / need consideration:

  - this still has everything in amapi.c rather than creating any new
    files. Also, the regression tests are in create_index.sql for lack
    of any obviously better place.

The list of column properties is:

  ordered  - (same as "amcanorder" AM capability)
  ordered_asc
  ordered_desc
  ordered_nulls_first
  ordered_nulls_last

If "ordered" is true then exactly one of _asc/_desc and exactly one of
_nulls_first/_last will be true; if "ordered" is false then all the
others will be false too. The intended usage is something like

  CASE WHEN pg_index_column_has_property(idx, attno, 'ordered_asc')
       THEN 'ASC'
       WHEN pg_index_column_has_property(idx, attno, 'ordered_desc')
       THEN 'DESC'
       ELSE ''  -- or NULL
  END

Comments?

--
Andrew (irc:RhodiumToad)


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proposal for CSN based snapshots
Next
From: Heikki Linnakangas
Date:
Subject: Re: Proposal for CSN based snapshots