Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on SQLite. #15062

Merged
merged 1 commit into from Nov 8, 2021

Conversation

matthijskooijman
Copy link
Contributor

When ExpressionWrapper was used to wrap a non-decimal Value with
output_field=DecimalField, it would not be converted to the right type
(NUMERIC) on SQLite, causing comparisons with proper decimals to fail.
Adding SQLiteNumericMixin ensures that the proper conversion is done
when needed.

In a slightly different way, when a Case/When is used to wrap a
Decimal/DecimalField value (literal or model field), it seems to be
converted to a non-decimal type (by SQLite it seems), also causing
comparisons to fail. Adding SQLiteNumericMixin also helps here.

Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthijskooijman Thanks 👍

I added assertSequenceEqual() to tests.

@felixxm felixxm changed the title Fixed #33257 -- Case and ExpressionWrapper with Decimal bn SQLite Fixed #33257 -- Fixed Case() and ExpressionWrapper() with decimal values on SQLite. Nov 8, 2021
@matthijskooijman
Copy link
Contributor Author

Looks good, thanks!

@felixxm felixxm merged commit 1a50238 into django:main Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants