JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.1k stars 677 forks source link

fix: EXPOSED-260 [Oracle] Pair.inList() fails if list contains single element #1970

Closed bog-walk closed 6 months ago

bog-walk commented 6 months ago

If a Pair/Triple is used with inList()/notInList() and the right-side list contains multiple elements, the SQL generated is:

WHERE (col1, col2) IN ((?, ?), (?, ?), ...)

If the right-side list only contains a single element, the SQL generated is:

WHERE (col1, col2) = (?, ?)

The latter works correctly for all supported databases except Oracle, which throws:

java.sql.SQLSyntaxErrorException: ORA-00920: invalid relational operator

This fix ensures that the IN and NOT IN operators are always used with Oracle regardless of the number of list elements.

Existing tests that excluded Oracle for this reason have been adjusted.