Fix in-array predicate rendering for cockroachdb

This commit is contained in:
Marco Belladelli 2023-04-28 11:07:49 +02:00
parent db3c73f302
commit 0d381db8b8
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35
2 changed files with 18 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import org.hibernate.sql.ast.tree.expression.Expression;
import org.hibernate.sql.ast.tree.expression.Literal;
import org.hibernate.sql.ast.tree.expression.Summarization;
import org.hibernate.sql.ast.tree.predicate.BooleanExpressionPredicate;
import org.hibernate.sql.ast.tree.predicate.InArrayPredicate;
import org.hibernate.sql.ast.tree.predicate.LikePredicate;
import org.hibernate.sql.ast.tree.select.QueryGroup;
import org.hibernate.sql.ast.tree.select.QueryPart;
@ -183,4 +184,12 @@ public class CockroachLegacySqlAstTranslator<T extends JdbcOperation> extends Ab
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
return false;
}
@Override
public void visitInArrayPredicate(InArrayPredicate inArrayPredicate) {
inArrayPredicate.getTestExpression().accept( this );
appendSql( " = ANY(" );
inArrayPredicate.getArrayParameter().accept( this );
appendSql( ')' );
}
}

View File

@ -15,6 +15,7 @@ import org.hibernate.sql.ast.tree.expression.Expression;
import org.hibernate.sql.ast.tree.expression.Literal;
import org.hibernate.sql.ast.tree.expression.Summarization;
import org.hibernate.sql.ast.tree.predicate.BooleanExpressionPredicate;
import org.hibernate.sql.ast.tree.predicate.InArrayPredicate;
import org.hibernate.sql.ast.tree.predicate.LikePredicate;
import org.hibernate.sql.ast.tree.select.QueryGroup;
import org.hibernate.sql.ast.tree.select.QueryPart;
@ -155,4 +156,12 @@ public class CockroachSqlAstTranslator<T extends JdbcOperation> extends Abstract
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
return false;
}
@Override
public void visitInArrayPredicate(InArrayPredicate inArrayPredicate) {
inArrayPredicate.getTestExpression().accept( this );
appendSql( " = ANY(" );
inArrayPredicate.getArrayParameter().accept( this );
appendSql( ')' );
}
}