#14229: Postgres backend generates invalid SQL when istartswith and F object are
combined.
---------------------------------+------------------------------------------
Reporter: ales_zoulek | Owner:
Status: new | Milestone:
Component: ORM aggregation | Version: SVN
Keywords: postgres database F | Stage: Unreviewed
Has_patch: 0 |
---------------------------------+------------------------------------------
How to reproduce:
It's quite easy, just try:
{{{
In [1]: from django.db.models import F
In [2]: from django.contrib.auth.models import User
In [3]:
str(User.objects.filter(first_name__istartswith=F('username')).query)
Out[3]: 'SELECT "auth_user"."id", "auth_user"."username",
"auth_user"."first_name", "auth_user"."last_name",
"auth_user"."email", "auth_user"."password", "auth_user"."is_staff",
"auth_user"."is_active", "auth_user"."is_superuser",
"auth_user"."last_login", "auth_user"."date_joined" FROM "auth_user"
WHERE UPPER("auth_user"."first_name"::text) LIKE
UPPER() "auth_user"."username"'
}}}
See the invalid closed UPPER() function at the end. This queryset will
ofcourse raise DatabaseError when executed.
--
Ticket URL: <http://code.djangoproject.com/ticket/14229>
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.