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)