Opened 13 years ago
Last modified 10 years ago
#16731 closed Bug
startswith and contains doesn't work with F expression — at Version 1
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | startswith, F(), wildcards |
Cc: | Koen Vossen | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The expression:
myTable.objects.filter(field1__startswith=F('field2'))
rendered to:
SELECT * FROM `my_table` WHERE `my_table`.`field1` LIKE `my_table`.`field2`
should be:
SELECT * FROM `my_table` WHERE `my_table`.`field1` LIKE CONCAT(`my_table`.`field2`,'%')
Change History (1)
comment:1 by , 13 years ago
Description: | modified (diff) |
---|---|
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
Fixed formatting - please use preview.
I have confirmed the problem as follows: