[ 
https://issues.apache.org/jira/browse/CALCITE-7407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18071039#comment-18071039
 ] 

hongyu guo edited comment on CALCITE-7407 at 4/4/26 2:10 PM:
-------------------------------------------------------------

I found that InferTypes.RETURN_TYPE can fix this bug, but it does not work in 
some cases, such as:
   SELECT ? || 'a' FROM t
because RETURN_TYPE requires an enclosing SqlCall. Also, InferTypes.FIRST_KNOWN 
produces the wrong result type, CHAR(xxx) which adds padding spaces.


was (Author: JIRAUSER300840):
I found that InferTypes.RETURN_TYPE can fix this bug, but it does not work in 
some cases, such as:
   SELECT ? || 'a' FROM t
because RETURN_TYPE requires an enclosing SqlCall. Also, InferTypes.FIRST_KNOWN 
produces the wrong result type, CHAR(n), which adds padding spaces.

> Illegal use of dynamic parameter with ||
> ----------------------------------------
>
>                 Key: CALCITE-7407
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7407
>             Project: Calcite
>          Issue Type: Bug
>          Components: jdbc-driver
>    Affects Versions: 1.41.0
>            Reporter: Jerome Isaac Haltom
>            Priority: Minor
>              Labels: pull-request-available
>
>     ---- java.sql.SQLException : Error while preparing statement [SELECT 
> "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", 
> "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", 
> "c"."PostalCode", "c"."Region"
> FROM "Customers" AS "c"
> WHERE "c"."CustomerID" = ((? || 'KI'))]
> -------- org.apache.calcite.runtime.CalciteContextException : At line 3, 
> column 28
> ------------ org.apache.calcite.sql.validate.SqlValidatorException : Illegal 
> use of dynamic parameter



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to