HHH-15576 Emulation of tuple comparison produces a wrong SQL query for NOT EQUAL operator
This commit is contained in:
parent
b2e4348d62
commit
90b308511d
|
@ -1950,8 +1950,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EQUAL:
|
case EQUAL: {
|
||||||
case NOT_EQUAL: {
|
|
||||||
final String operatorText = operator.sqlText();
|
final String operatorText = operator.sqlText();
|
||||||
String separator = NO_SEPARATOR;
|
String separator = NO_SEPARATOR;
|
||||||
for ( int i = 0; i < size; i++ ) {
|
for ( int i = 0; i < size; i++ ) {
|
||||||
|
@ -1963,6 +1962,18 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NOT_EQUAL: {
|
||||||
|
final String operatorText = operator.sqlText();
|
||||||
|
String separator = NO_SEPARATOR;
|
||||||
|
for ( int i = 0; i < size; i++ ) {
|
||||||
|
appendSql( separator );
|
||||||
|
lhsExpressions.get( i ).accept( this );
|
||||||
|
appendSql( operatorText );
|
||||||
|
rhsExpressions.get( i ).accept( this );
|
||||||
|
separator = " or ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case LESS_THAN_OR_EQUAL:
|
case LESS_THAN_OR_EQUAL:
|
||||||
// Optimized (a, b) <= (1, 2) as: a <= 1 and not (a = 1 and b > 2)
|
// Optimized (a, b) <= (1, 2) as: a <= 1 and not (a = 1 and b > 2)
|
||||||
// Normal (a, b) <= (1, 2) as: a < 1 or a = 1 and (b <= 2)
|
// Normal (a, b) <= (1, 2) as: a < 1 or a = 1 and (b <= 2)
|
||||||
|
|
Loading…
Reference in New Issue