#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
-------------------------------------+-------------------------------------
Changes (by shaib):

 * cc: shaib (added)


Comment:

 I've just closed #20971 as a duplicate of this one, because the issue is
 presented more clearly here.

 Quoting my comment from that ticket:

 > This seems to be a correctness problem on Oracle, but may cause
 performance issues elsewhere (other backends will group over deferred
 fields, in particular text-fields, which may indeed bring back the
 problems of #17144).

 Of jarshwah's options, I think option 4 (removing deferred columns from
 the group-by) is a no-brainer (even if the PK is not available). I find
 option 3 unacceptable (except on MySql, perhaps... no, I'm kidding), and
 option 1 vastly inferior.

 With respect to removal, I don't like the idea of completely automatic
 removal. Too much magic for my tastes. But -- having actually implemented
 such automatic removal for a project I was involved with (in a custom
 query-set class) -- I do see the need for it to be easy; and per my
 comment above, I also think we should tell non-Oracle users about it.

 So my suggestion is:
 1. Add a database-feature `can_compare_LOBs`
 2. When a query groups over a LOB -- if `can_compare_LOBs`, warn about
 performance implications; else, error out (with a clear Django exception
 rather than an obscure Oracle error)
 3. Add a query-set method to defer all LOBs, and/or a query-set subclass
 that does it automatically.

--
Ticket URL: <https://code.djangoproject.com/ticket/24096#comment:4>
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.e633843a2d5d5036a4a7e852974fedca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to