by bluedino · 5y ago · 0 comments
Perhaps the system "isn't very smart" like it says, or it was originally intended for other purposes.
> However, PostgreSQL's planner is currently not very smart about such cases.
(From https://www.postgresql.org/docs/10/indexes-index-only-scans....)
I suspect this is just a rough edge. Many types of functions may not be consistent, and therefore would need to be re-executed on the original data. Perhaps some of the planner functionality here predates function notation like `IMMUTABLE`.
This is a bit of an uncommon case that would need special handling in the query planner. So it's not that odd that it is not implemented yet, though I would suspect that it'll be added at some point.