#14879: Aggregates (Min, Max) for CharField fails with Postgresql
----------------------------------------------+-----------------------------
 Reporter:  wejaay                            |       Owner:  nobody    
   Status:  new                               |   Milestone:            
Component:  Database layer (models, ORM)      |     Version:  1.2       
 Keywords:  aggregate, postgresql, charfield  |       Stage:  Unreviewed
Has_patch:  0                                 |  
----------------------------------------------+-----------------------------
 If you try to do aggregate on a {{{CharField}}} using with Min or Max, it
 works fine in sqlite3 but fails in PostgresSQL. I have version 9.0 of
 postgres and latest dev version of django.

 The error occurs because Django is trying to convert the string to float
 in
 
http://code.djangoproject.com/browser/django/trunk/django/db/backends/__init__.py?rev=9742,
 line number 399.
 Thats the version where this code was first introduced and as far as I can
 tell its been broken all the way from then to most recent version
 
http://code.djangoproject.com/browser/django/trunk/django/db/backends/__init__.py,
 line 553.

 One fix that seems to work is to change line 549 from {{{ elif
 internal_type in ('DateField', 'DateTimeField', 'TimeField'):}}} to
 {{{elif internal_type in ('DateField', 'DateTimeField', 'TimeField',
 'CharField'):}}}

 I dont know if that has other side effects. If I am doing something wrong,
 please let me know.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14879>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to