﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24096	GROUP BY on oracle fails with TextField and BinaryField	Josh Smeaton	nobody	"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.
"	Bug	closed	Database layer (models, ORM)	dev	Normal	duplicate		josh.smeaton@… Shai Berger mail@… robinchew@…	Accepted	0	0	0	0	0	0
