#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 akaariai):
I guess there is also option 6: rework the query to something like:
{{{
SELECT innerq.*, basetable.lob
FROM (SELECT <original_query_without_lob_fields>) innerq
INNER JOIN basetable on basetable.id = innerq.id
}}}
That is, run the original select query without LOB fields, then join the
LOB fields back. Needless to say this solution is likely complex to
implement. I think the solution would likely look something like this:
- Generate the select and group by of the query. If the select list has
any LOB fields, then remove them from the select and group by and memoize
what was removed.
- Generate the inner query
- Join back the memoized columns in an outer query
- You can't actually use SQL using innerq.* as mentioned above, the
SELECT list must be in the same order as it was for the original query so
that select_related works properly.
As this solution is likely too complex, I think I like the
Meta.always_defer approach instead. There should be some way to override
the defer though (.defer(None) would clear always_defers, too?)
--
Ticket URL: <https://code.djangoproject.com/ticket/24096#comment:7>
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.3eb99bfd071e2e982297af84fcaac205%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.