#24096: GROUP BY on oracle fails with TextField and BinaryField
-------------------------------------+-------------------------------------
Reporter: jarshwah | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by jarshwah):
The problem with 4 is that natural queries that run on most backends will
fail on Oracle:
{{{
Model.objects.annotate(Count('field')) # error on Oracle with
TextField, fine on others..
Model.objects.defer('text_field').annotate(Count('field')) # required
for Oracle, and suggested for others
}}}
While option 5 is somewhat magical, it's also the best way to have cross-
database querysets work without modification. Oracle users will always
need to defer LOB-like columns, and will never need to un-defer (since
it's an error). Raising a warning on other backends should be enough if
they haven't deferred. We could control this behaviour with a setting, but
that seems a little wasteful.
Another thing to remember is that any models added with select_related
will also require their LOB like columns to be deferred.
I'm not a fan of adding a new queryset method to defer a certain class of
column, and I'm not too partial about adding a queryset subclass either -
since it'd require special knowledge to recognise that it'd be needed, and
will be a source of bugs in libraries that define models with TextFields,
but do not test annotations on Oracle.
Another direction could be a meta option: Meta.always_defer = ('field',
'text_field'), with a recommendation to always defer large, rarely used
fields. This will have applications larger than this somewhat-narrow
usecase, and will be a lot less magical.
--
Ticket URL: <https://code.djangoproject.com/ticket/24096#comment:5>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.fe468f69e389f2e2ac532d9c069cce16%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.