﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29222	Substr on NULL values returns incorrect results with pattern lookups.	Mariusz Felisiak	nobody	"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."	Bug	new	Database layer (models, ORM)	dev	Normal		Oracle		Unreviewed	0	0	0	0	0	0
