Skip to content

IsIn condition with empty list is not rendered, and selects the entire table #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
franck102 opened this issue Nov 28, 2022 · 2 comments
Closed

Comments

@franck102
Copy link

I have found this issue that discusses the problem:
[https://github.com//issues/228]

... however I don't understand if or how the issue was resolved. The documentation mentions a NonRenderingWhereClauseException that should be thrown with the default configuration, however this is not the behavior I am seeing with org.mybatis.dynamic-sql:mybatis-dynamic-sql:1.4.1: the condition is simply dropped and the entire table is returned.
Looking through the source code of the IsIn class I don't see that exception being used anywhere... am I missing something? I tried explicitly setting nonRenderingWhereClauseAllowed to true in a global config file and that didn't make any difference.

Above all, why can't IsIn() simply be rendered as "WHERE FALSE"??? This seems like the natural, safe, easy thing to do?

@jeffgbutler
Copy link
Member

The exception is thrown when a where clause fails to render. You can see the code here:

if (whereClause.isPresent() || whereModel.isNonRenderingClauseAllowed()) {
return whereClause;
} else {
throw new NonRenderingWhereClauseException();
}

If you have found a case where this isn't working, please post the failing code so we can fix it.

@jeffgbutler
Copy link
Member

Closing as there is no response. Please feel free to reopen if you find a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants