[
https://issues.apache.org/jira/browse/CALCITE-6436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17854903#comment-17854903
]
xiong duan commented on CALCITE-6436:
-------------------------------------
Make sense. How about we change the summary to 'JDBC adapter generates wrong
SQL when WHERE clause include bindable parameter' to make this issue more
clearly.
> Missing round brackets in WHERE condition which contains calculations
> ---------------------------------------------------------------------
>
> Key: CALCITE-6436
> URL: https://issues.apache.org/jira/browse/CALCITE-6436
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.37.0
> Reporter: Ulrich Kramer
> Priority: Major
>
> Running the following unit test in {{JdbcAdapterTest}} fails with
> {code:java}
> @Test void testOperatorInWhere() {
> CalciteAssert.model(FoodmartSchema.FOODMART_MODEL)
> .query("select * from \"sales_fact_1997\" "
> + "where (\"product_id\" = 1) = ?")
> .consumesPreparedStatement(p -> p.setBoolean(1, true))
> .runs();
> }
> {code}
> {noformat}
> Caused by: java.sql.SQLSyntaxErrorException: unexpected token: = : line: 3 in
> statement [SELECT *
> FROM "foodmart"."sales_fact_1997"
> WHERE "product_id" = 1 = ?
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)