On Saturday, April 13, 2013 7:54:43 PM UTC+3, Ian wrote:
>
> On Saturday, April 13, 2013 10:40:10 AM UTC-6, Ian wrote:
>>
>> On Friday, April 12, 2013 7:43:32 AM UTC-6, Lauri Savolainen wrote:
>>>
>>> Thank you for the reply,
>>>
>>> The field is defined in the Django model as:
>>> location_description = models.TextField(_('additional route 
>>> information'), blank=True)
>>>
>>> Data length for the corresponding column in the database seems to be 
>>> 4000 and the type is NCLOB. The database is created by Django's syncdb and 
>>> is not a legacy one.
>>>
>>> This is the raw SQL query the Django admin interface produces:
>>>
>>> SELECT DISTINCT "app_route"."id", 
>>>                 "app_route"."route_no", 
>>>                 "app_route"."owner_no", 
>>>                 "app_route"."municipality_code", 
>>>                 "app_route"."location_description", 
>>>                 "app_route"."latitude", 
>>>                 "app_route"."longitude" 
>>> FROM   "app_route" 
>>>        inner join "app_observationevent" 
>>>                ON ( "app_route"."id" = 
>>>                     "app_observationevent"."route_id" ) 
>>> WHERE  "app_observationevent"."observation_date" >= :arg0 
>>> ORDER  BY "app_route"."id" DESC 
>>>
>>> Executing it via the Django management shell django.db.connection 
>>> produces the same error (ORA-00932: inconsistent datatypes: expected - got 
>>> NCLOB) but when I remove the "app_route"."location_description" field 
>>> from the SELECT projection the query executes successfully.
>>>
>>>
>> Yes, this is caused by the use of a SELECT DISTINCT over a LOB column, 
>> which Oracle does not allow.  The DISTINCT was added to admin queries over 
>> joined fields as a result of ticket #15819.  As for workarounds -- I'm 
>> afraid I don't have any suggestions for you.
>>
>
> Actually, one suggestion: you could try removing the field from the 
> list_display option on the ModelAdmin.  I think you would also need to 
> override the get_queryset method on the ModelAdmin to .defer() the field, 
> as it doesn't look like the admin would do that automatically.
>

Hello,

Neither approach seemed to work so I ended up changing the field to a 
fixed-length type in the model and resyncing my tables which seems to work. 
Anyways, thank you for the suggestions.

- Lauri Savolainen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to