#11975: invalid sql returned from
django.db.backends.sqlite3.DatabaseOperations.date_trunc_sql
------------------------------------------+---------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: SVN
Keywords: sqlite DatabaseOperations | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
this method returns 'django_date_trunc("<precision>", <field>)'. in
sqlite3, double quoted strings are identifiers, and string literals are
single quoted (see http://www.sqlite.org/lang_keywords.html). so it should
return "django_date_trunc('<precision>', <field>)". this breaks code such
as the following:
{{{
MyModel.objects.extra(select={'year':connection.ops.date_trunc_sql('year',
'"mymodel"."date"')}).values('year').order_by().annotate(total=Count('pk'))
}}}
the resulting query:
{{{
[{'time': '0.007', 'sql': u'SELECT (django_date_trunc("year",
"mymodel"."date")) AS "year", COUNT("mymodel"."id") AS "total" FROM
"mymodel" GROUP BY django_date_trunc("year", "mymodel"."date")'}]
}}}
same problem exists with date_extract_sql()
--
Ticket URL: <http://code.djangoproject.com/ticket/11975>
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
-~----------~----~----~----~------~----~------~--~---