Index: sqlite3.py
===================================================================
--- sqlite3.py	(revision 983)
+++ sqlite3.py	(working copy)
@@ -34,7 +34,6 @@
         if self.connection is None:
             self.connection = Database.connect(DATABASE_NAME, detect_types=Database.PARSE_DECLTYPES)
             # register extract and date_trun functions
-            self.connection.create_function("django_extract", 2, _sqlite_extract)
             self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc)
         cursor = self.connection.cursor(factory=SQLiteCursorWrapper)
         cursor.row_factory = utf8rowFactory
@@ -81,17 +80,10 @@
 
 def get_date_extract_sql(lookup_type, table_name):
     # lookup_type is 'year', 'month', 'day'
-    # sqlite doesn't support extract, so we fake it with the user-defined
-    # function _sqlite_extract that's registered in connect(), above.
-    return 'django_extract("%s", %s)' % (lookup_type.lower(), table_name)
+    # sqlite doesn't support extract, so we fake it with the strftime function
+    date_codes = {'year': '"%%Y"', 'month': '"%%m"', 'day': '"%%d"'}
+    return 'strftime(%s, %s)' % (date_codes[lookup_type], table_name)
 
-def _sqlite_extract(lookup_type, dt):
-    try:
-        dt = typecasts.typecast_timestamp(dt)
-    except (ValueError, TypeError):
-        return None
-    return str(getattr(dt, lookup_type))
-
 def get_date_trunc_sql(lookup_type, field_name):
     # lookup_type is 'year', 'month', 'day'
     # sqlite doesn't support DATE_TRUNC, so we fake it as above.
