ossc-db / pg_hint_plan

Extension adding support for optimizer hints in PostgreSQL
Other
715 stars 103 forks source link

Fix #105 Consider indexes other than btree in restrict_indexes(). #106

Closed tideri closed 1 year ago

tideri commented 2 years ago

Fix #105 Consider indexes other than btree in restrict_indexes.

When SQL was executed with IndexScan hints for non-btree indexes (such as the gin index) agains a partitioned table, PostgreSQL crashed. This is because indexes other than btree do not support order by operation and variables related to this were NULL.

horiguti commented 1 year ago

Thank you for the patch. The direction seems correct and the fix is mostly good. I slightly adjusted the logic and added a comment then pushed.

horiguti commented 1 year ago

Oops! There seems to be a case the patch is not sufficient. Reopen this and continue thinking on this.

horiguti commented 1 year ago

The code needs to check info->sortopfamily. So I fixed it. And the previous commit doesn't even compile so I once reverted the previous one then re-commited the correct one.