#29222: Substr on NULL values returns incorrect results with pattern lookups.
-------------------------------------+-------------------------------------
               Reporter:  felixxm    |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  master
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  Oracle
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29222>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.026f619622752ae0fabd6189e6bfa53e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to