Leonardo F <m_lists(at)yahoo(dot)it> writes:
>> one idea could be to actually prepare a query using SPI for "select * from table order by <cols>" and then peek inside
>> to see which plan was generated.
> I like that!!!
> Here's a first attempt, it looks like it's working...
> (I still have to skip non-btree indexes and expression indexes, plus
> add a ASC/DESC to the select)
By the time you make this actually work in all cases, it's probably
going to be more of a mess than the other way; not to mention that it
doesn't work *at all* without violating SPI internals.
regards, tom lane