Fixed #35194 -- Fixed case-insensitive operations in GeneratedFields on Postgres 15.6+. #18085
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trac ticket number
ticket-35194
Branch description
Postgres >= 12.18, 13.14, 14.11, 15.6, 16.2 changed the way the immutability of generated and default expressions is detected in postgres/postgres@743ddaf.
This reverts the optimization of using UPPER instead of ILIKE for postgres case-insensitive comparisons as UPPER can return different value depending on the collation and thus is not immutable.
See: https://code.djangoproject.com/ticket/3575
I can see a StackOverflow discussion on how using LOWER/UPPER LIKE is faster than using ILIKE by roughly ~17%, however the advice is also "just use an index".
So....
I guess users could chose to use upper/lower themselves to achieve what we were doing in the background if they experience a performance regression and do not want to use an index 🤔
Checklist
main
branch.