File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
hibernate-community-dialects/src/main/java/org/hibernate/community/dialect
hibernate-core/src/main/java/org/hibernate Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -251,4 +251,10 @@ public int rowIdSqlType() {
251251 public String getRowIdColumnString (String rowId ) {
252252 return rowId ( rowId ) + " rowid not null generated always" ;
253253 }
254+
255+ @ Override
256+ public boolean supportsValuesList () {
257+ // DB2 z/OS has a VALUES statement, but that doesn't support multiple values
258+ return false ;
259+ }
254260}
Original file line number Diff line number Diff line change @@ -211,4 +211,10 @@ public int rowIdSqlType() {
211211 public String getRowIdColumnString (String rowId ) {
212212 return rowId ( rowId ) + " rowid not null generated always" ;
213213 }
214+
215+ @ Override
216+ public boolean supportsValuesList () {
217+ // DB2 z/OS has a VALUES statement, but that doesn't support multiple values
218+ return false ;
219+ }
214220}
Original file line number Diff line number Diff line change @@ -7628,12 +7628,21 @@ public void visitInListPredicate(InListPredicate inListPredicate) {
76287628 else if ( !dialect .supportsRowValueConstructorSyntaxInInList () ) {
76297629 // Some DBs like Oracle support tuples only for the IN subquery predicate
76307630 if ( dialect .supportsRowValueConstructorSyntaxInInSubQuery () && dialect .supportsValuesList () ) {
7631+ final int tupleSize = lhsTuple .getExpressionType ().getJdbcTypeCount ();
76317632 inListPredicate .getTestExpression ().accept ( this );
76327633 if ( inListPredicate .isNegated () ) {
76337634 appendSql ( " not" );
76347635 }
7635- appendSql ( " in (select * from (values " );
7636+ appendSql ( " in (select" );
76367637 char separator = ' ' ;
7638+ for ( int i = 0 ; i < tupleSize ; i ++ ) {
7639+ appendSql ( separator );
7640+ appendSql ( "v_.c" );
7641+ appendSql ( i );
7642+ separator = ',' ;
7643+ }
7644+ appendSql ( " from (values" );
7645+ separator = ' ' ;
76377646 for ( Expression expression : listExpressions ) {
76387647 appendSql ( separator );
76397648 appendSql ( OPEN_PARENTHESIS );
@@ -7642,6 +7651,15 @@ else if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
76427651 separator = ',' ;
76437652 }
76447653 appendSql ( CLOSE_PARENTHESIS );
7654+ appendSql ( " v_" );
7655+ separator = '(' ;
7656+ for ( int i = 0 ; i < tupleSize ; i ++ ) {
7657+ appendSql ( separator );
7658+ appendSql ( "c" );
7659+ appendSql ( i );
7660+ separator = ',' ;
7661+ }
7662+ appendSql ( CLOSE_PARENTHESIS );
76457663 appendSql ( CLOSE_PARENTHESIS );
76467664 }
76477665 else if ( dialect .supportsRowValueConstructorSyntaxInInSubQuery () && dialect .supportsUnionAll () ) {
You can’t perform that action at this time.
0 commit comments