Skip to content

Commit ad4dcca

Browse files
committed
HHH-18352 Don't emulate tuple comparison with subquery if possible
1 parent aeab7ac commit ad4dcca

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/OracleSqlAstTranslator.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -606,21 +606,11 @@ protected boolean supportsRowValueConstructorSyntax() {
606606
return false;
607607
}
608608

609-
@Override
610-
protected boolean supportsRowValueConstructorSyntaxInInList() {
611-
return true;
612-
}
613-
614609
@Override
615610
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
616611
return false;
617612
}
618613

619-
@Override
620-
protected boolean supportsRowValueConstructorSyntaxInInSubQuery() {
621-
return true;
622-
}
623-
624614
@Override
625615
protected String getDual() {
626616
return "dual";

hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8285,14 +8285,14 @@ else if ( subquery != null && !supportsRowValueConstructorSyntaxInQuantifiedPred
82858285
else if ( needsTupleComparisonEmulation( operator ) ) {
82868286
rhsTuple = SqlTupleContainer.getSqlTuple( rhsExpression );
82878287
assert rhsTuple != null;
8288-
// Some DBs like Oracle support tuples only for the IN subquery predicate
8289-
if ( ( operator == ComparisonOperator.EQUAL || operator == ComparisonOperator.NOT_EQUAL ) && supportsRowValueConstructorSyntaxInInSubQuery() ) {
8288+
// If the DB supports tuples in the IN list predicate, use that syntax as it's more concise
8289+
if ( ( operator == ComparisonOperator.EQUAL || operator == ComparisonOperator.NOT_EQUAL ) && supportsRowValueConstructorSyntaxInInList() ) {
82908290
comparisonPredicate.getLeftHandExpression().accept( this );
82918291
if ( operator == ComparisonOperator.NOT_EQUAL ) {
82928292
appendSql( " not" );
82938293
}
82948294
appendSql( " in (" );
8295-
renderExpressionsAsSubquery( rhsTuple.getExpressions() );
8295+
rhsTuple.accept( this );
82968296
appendSql( CLOSE_PARENTHESIS );
82978297
}
82988298
else {

0 commit comments

Comments
 (0)