#24096: GROUP BY on oracle fails with TextField and BinaryField
----------------------------------------------+--------------------
     Reporter:  jarshwah                      |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  master
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 When a GROUP BY is generated that includes a column of type LOB
 (BLOB/NCLOB) such as TextField or BinaryField, then an error is thrown on
 Oracle. See the test case below:

 {{{

 class Author(models.Model):
     name = models.CharField(max_length=100)
     bio = models.TextField(default='')
     age = models.IntegerField()
     friends = models.ManyToManyField('self', blank=True)


 def test_annotate_with_textfield_in_values(self):
         qs = Author.objects.annotate(min=Min('pk')).order_by('pk')
         self.assertQuerysetEqual(
             qs, [ 1, 1, 1, 1, 1, 1, 1 ],
             transform=lambda a: a.min
         )

 django.db.utils.DatabaseError: ORA-00932: inconsistent datatypes: expected
 - got NCLOB
 }}}

 Adding a `defer('bio')` does not work either, as it's still included in
 the GROUP BY (but not the SELECT). The only way I could get this to work
 is by providing a `values()`, and listing all fields except LOB type
 columns.

 This isn't a regression either - the same testcase fails on the 1.6
 branch.

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

Reply via email to