Opened 14 years ago
Closed 14 years ago
#15914 closed Bug (duplicate)
F-expressions used with iexact lookup produces invalid SQL
Reported by: | Łukasz Rekucki | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Example queries generated from Employee.objects.filter(firstname__iexact=F('lastname'))
:
-- 1. PostgreSQL SELECT "expressions_employee"."id", "expressions_employee"."firstname", "expressions_employee"."lastname" FROM "expressions_employee" WHERE UPPER("expressions_employee"."firstname"::text) = UPPER() "expressions_employee"."lastname" -- DatabaseError: syntax error at or near ""expressions_employee"" -- LINE 1: ...xpressions_employee"."firstname"::text) = UPPER() "expressio... -- 2. SQLite SELECT "expressions_employee"."id", "expressions_employee"."firstname", "expressions_employee"."lastname" FROM "expressions_employee" WHERE "expressions_employee"."firstname" LIKE ESCAPE '\' "expressions_employee"."lastname" -- DatabaseError: near "ESCAPE": syntax error
I found the error on Django 1.2. Reproduced on trunk (see attachment)
Attachments (1)
Change History (2)
by , 14 years ago
Attachment: | iexact_regression.diff added |
---|
comment:1 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I could reproduce the error with that test case.
It seems to me that #11722 reported the same problem.
Note:
See TracTickets
for help on using tickets.
Test case to reproduce the error.