ossc-db / pg_hint_plan

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

Hint IndexScan: more docs and (possibly) check names #196

Closed danolivo closed 2 weeks ago

danolivo commented 1 month ago

I rarely use pg_hint_plan. So, my apologies if you have already fixed that. If a query contains: .. FROM table AS .. the IndexScan hint will search for , not for the real table name. It should be explained in the documentation. Moreover, it's worth considering implementing error handling for scan hints. The tool is case-sensitive, treating 'TABLE' and 'table' as different names. While all names during the query -> parsetree process are forced to be in lowercase, not all users may be aware of this. To enhance user confidence, it could be beneficial to check the existence of the table and index mentioned by the hint in the query. After all, the Set() hint throws an error in the case of an incorrect GUC name, so why not do the same for scan hints?

michaelpq commented 1 month ago

Could you send a patch with all the suggestions you have in mind?

There is already a bit, like https://pg-hint-plan.readthedocs.io/en/pg16/hint_details.html#upper-and-lower-case-handling-in-object-names.

danolivo commented 1 month ago

I don't have it in code right now. But if you can apply a pull request, I would gladly write the code; it looks pretty simple.

michaelpq commented 1 month ago

I can review, edit and apply pull requests. I have commit rights on this repository.

michaelpq commented 2 weeks ago

For now, please note that I am closing the bug as of a lack of activity. If you'd like to improve the documentation and/or the code, please feel free to send a pull request or a patch.