Skip to content

Commit 3d48388

Browse files
committed
HHH-18352 Don't emulate tuple comparison with subquery if possible
1 parent 1d87db4 commit 3d48388

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
@@ -539,21 +539,11 @@ protected boolean supportsRowValueConstructorSyntax() {
539539
return false;
540540
}
541541

542-
@Override
543-
protected boolean supportsRowValueConstructorSyntaxInInList() {
544-
return true;
545-
}
546-
547542
@Override
548543
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
549544
return false;
550545
}
551546

552-
@Override
553-
protected boolean supportsRowValueConstructorSyntaxInInSubQuery() {
554-
return true;
555-
}
556-
557547
@Override
558548
protected String getFromDual() {
559549
return " from 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
@@ -7714,14 +7714,14 @@ else if ( subquery != null && !supportsRowValueConstructorSyntaxInQuantifiedPred
77147714
else if ( needsTupleComparisonEmulation( operator ) ) {
77157715
rhsTuple = SqlTupleContainer.getSqlTuple( rhsExpression );
77167716
assert rhsTuple != null;
7717-
// Some DBs like Oracle support tuples only for the IN subquery predicate
7718-
if ( ( operator == ComparisonOperator.EQUAL || operator == ComparisonOperator.NOT_EQUAL ) && supportsRowValueConstructorSyntaxInInSubQuery() ) {
7717+
// If the DB supports tuples in the IN list predicate, use that syntax as it's more concise
7718+
if ( ( operator == ComparisonOperator.EQUAL || operator == ComparisonOperator.NOT_EQUAL ) && supportsRowValueConstructorSyntaxInInList() ) {
77197719
comparisonPredicate.getLeftHandExpression().accept( this );
77207720
if ( operator == ComparisonOperator.NOT_EQUAL ) {
77217721
appendSql( " not" );
77227722
}
77237723
appendSql( " in (" );
7724-
renderExpressionsAsSubquery( rhsTuple.getExpressions() );
7724+
rhsTuple.accept( this );
77257725
appendSql( CLOSE_PARENTHESIS );
77267726
}
77277727
else {

0 commit comments

Comments
 (0)