#31197: CheckConstraints with F objects don't apply on SQLite
-------------------------------------+-------------------------------------
Reporter: Adam (Chainz) | Owner: nobody
Johnson |
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Adam (Chainz) Johnson):
If I apply this patch, it works:
{{{
diff --git django/db/models/expressions.py django/db/models/expressions.py
index 2b59dd301a..5ee3baf6f1 100644
--- django/db/models/expressions.py
+++ django/db/models/expressions.py
@@ -528,6 +528,8 @@ class F(Combinable):
def resolve_expression(self, query=None, allow_joins=True,
reuse=None,
summarize=False, for_save=False,
simple_col=False):
+ # Override
+ simple_col = True
return query.resolve_ref(self.name, allow_joins, reuse,
summarize, simple_col)
def asc(self, **kwargs):
}}}
It looks like `CheckConstraint._get_check_sql` ends up passing
`simple_col=True` in `Query.build_filter` but this doesn't get passed down
to the `F` objects because the intermediate `CombinedExpression`s don't
pass on the parameter?
--
Ticket URL: <https://code.djangoproject.com/ticket/31197#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.180a3d0d5dc11f3dcaa053e7d678692b%40djangoproject.com.