Skip to content

SQL: Wrong NULL folding of expression #35232

@matriv

Description

@matriv
SELECT POSITION('x',LCASE("first_name")) pos, "first_name" FROM "test_emp"
WHERE POSITION('x',LCASE("first_name")) != 0 OR POSITION('x',LCASE("first_name")) IS NULL;

is translated to:

"InternalSqlScriptUtils.nullSafeFilter(InternalSqlScriptUtils.neq(InternalSqlScriptUtils.position(params.v0,InternalSqlScriptUtils.lcase(InternalSqlScriptUtils.docValue(doc,params.v1))),params.v2))"

The right part of the OR is missing because it's wrongly folded by the FoldNull rule. The POSITION can potentially be null.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions