Opened 7 years ago
Last modified 3 years ago
#29222 new Bug
Substr on NULL values returns incorrect results with pattern lookups. — at Initial Version
Description ¶
feb683c4c2c5ecfb61e4cb490c3e357450c0c0e8 revealed an unrelated issue on Oracle. SUBSTR(NULL, x, y)
returns NULL
on Oracle which can be concatenate with other strings, hence if we use it with pattern lookups then all rows match an query, e.g.
__startswith=Substr(sth, x, y)
->LIKE SUBSTR(sth, x, y) || '%'
->LIKE '%'
,__endswith=Substr(sth, x, y)
->LIKE '%' || SUBSTR(sth, x, y)
->LIKE '%'
,__contains=Substr(sth, x, y)
->LIKE '%' || SUBSTR(sth, x, y) || '%'
->LIKE '%%'
,
which is unexpected.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Note:
See TracTickets
for help on using tickets.