#8597: PostgreSQL: r8536 broke iexact lookups with underscores
-------------------------------------+--------------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  nobody    
   Status:  new                      |   Milestone:            
Component:  Database wrapper         |     Version:  SVN       
 Keywords:                           |       Stage:  Unreviewed
Has_patch:  0                        |  
-------------------------------------+--------------------------------------
 Changeset [8536] changed the way field iexact lookups are translated in
 the PostgreSQL backend. Before the patch, these were translated to "ILIKE
 %s". Now it's "UPPER(field) = UPPER(%s)". However, the %s value is still
 escaped for use in a LIKE expression, that is, all underscores are
 prepended with "\\".

 Before the patch (correct):

 {{{
 >>> User.objects.filter(username__iexact='test_user').query.as_sql()
 ('SELECT [...] FROM "auth_user" WHERE "auth_user"."username"::text ILIKE
 %s ', (u'test\\_user',))
 }}}

 After the patch (wrong):

 {{{
 User.objects.filter(username__iexact='test_user').query.as_sql()
 ('SELECT [...] FROM "auth_user" WHERE UPPER("auth_user"."username"::text)
 = UPPER(%s) ', (u'test\\_user',))
 }}}

 As a result, iexact lookups no longer work in the current version with
 PostgreSQL, if the comparison value contains an underscore.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8597>
Django Code <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