#3501: [patch] sqlite selection on datetime members fail when datefield is null
---------------------------------------------------+------------------------
          Reporter:  anonymous                     |         Owner:  baumer1122
            Status:  reopened                      |     Milestone:            
         Component:  Database layer (models, ORM)  |       Version:  SVN       
        Resolution:                                |      Keywords:  sqlite    
             Stage:  Accepted                      |     Has_patch:  1         
        Needs_docs:  0                             |   Needs_tests:  1         
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by jerry):

  * status:  closed => reopened
  * resolution:  worksforme =>

Comment:

 The problem appears to be with .filter(date__month=x). Using 1.0.1 I can
 successfully perform the tests above on my own data, but when I try
 __month (without the above patch applied) I get:

 >>> Album.objects.filter(purchaseDate__month=3)
 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "/Library/Python/2.5/site-packages/django/db/models/query.py", line
 147, in __repr__
     data = list(self[:REPR_OUTPUT_SIZE + 1])
   File "/Library/Python/2.5/site-packages/django/db/models/query.py", line
 162, in __len__
     self._result_cache.extend(list(self._iter))
   File "/Library/Python/2.5/site-packages/django/db/models/query.py", line
 275, in iterator
     for row in self.query.results_iter():
   File "/Library/Python/2.5/site-packages/django/db/models/sql/query.py",
 line 206, in results_iter
     for rows in self.execute_sql(MULTI):
   File "/Library/Python/2.5/site-packages/django/db/models/sql/query.py",
 line 1734, in execute_sql
     cursor.execute(sql, params)
   File "/Library/Python/2.5/site-
 packages/django/db/backends/sqlite3/base.py", line 168, in execute
     return Database.Cursor.execute(self, query, params)
 OperationalError: user-defined function raised exception

 The same with __day; it fails as above; but applying the patch to
 _sqlite_extract, the errors go away and the filter works as expected. (And
 I can use the admin to focus on the date_hierarchy field.)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3501#comment:8>
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 django-updates@googlegroups.com
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