Skip to content

"In" and "NotIn" Conditions Render Incorrectly in Some Circumstances #239

Closed
@jeffgbutler

Description

@jeffgbutler

Currently the decision about whether or not to render an "In" or "NotIn" condition is made before any filter or map is applied to the value list. Then can cause incorrect rendering in some cases. For example, if a filter removes all items from a value list the condition will still render - yielding invalid SQL. For example, the following will render incorrectly:

SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
        .from(animalData)
        .where(id, isIn(null, 22, null).then(s -> s.filter(Objects::nonNull).filter(i -> i != 22)))
        .build()
        .render(RenderingStrategies.MYBATIS3);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions