[ 
https://issues.apache.org/jira/browse/IGNITE-22444?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Evgeny Stanilovsky updated IGNITE-22444:
----------------------------------------
    Description: 
According to standard:

{noformat}
Values of either the CHARACTER or CHARACTER VARYING data type can be assigned 
to the other type, subject to truncation conditions
{noformat}
Thus i expect such expressions need to be processed correctly, but it fails:


{noformat}
create table tiny(v TINYINT);
insert into tiny values(127);
SELECT * FROM tiny WHERE v < '300';
{noformat}


{noformat}
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-5 
TraceId:cfce3f69-606e-482b-b267-260f8569df62 Value '300' out of range for type 
TINYINT
        at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.literalCanFitType(IgniteSqlValidator.java:714)
        at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.checkTypesInteroperability(IgniteSqlValidator.java:680)
        at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.deriveType(IgniteSqlValidator.java:550)
{noformat}

Check: AbstractTypeCoercion#commonTypeForBinaryComparison

  was:
According to standard:

{noformat}
Values of either the CHARACTER or CHARACTER VARYING data type can be assigned 
to the other type, subject to truncation conditions
{noformat}
Thus i expect such expressions need to be processed correctly, but it fails:


{noformat}
create table tiny(v TINYINT);
insert into tiny values(127);
SELECT * FROM tiny WHERE v < '300';
{noformat}


{noformat}
Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-5 
TraceId:cfce3f69-606e-482b-b267-260f8569df62 Value '300' out of range for type 
TINYINT
        at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.literalCanFitType(IgniteSqlValidator.java:714)
        at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.checkTypesInteroperability(IgniteSqlValidator.java:680)
        at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.deriveType(IgniteSqlValidator.java:550)
{noformat}

Seems such a problem was introduced here [1]

[1] IGNITE-18662


> Sql. Assign CHARACTER or CHARACTER VARYING to the other type.
> -------------------------------------------------------------
>
>                 Key: IGNITE-22444
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22444
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 3.0.0-beta1
>            Reporter: Evgeny Stanilovsky
>            Assignee: Evgeny Stanilovsky
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 3h
>  Remaining Estimate: 0h
>
> According to standard:
> {noformat}
> Values of either the CHARACTER or CHARACTER VARYING data type can be assigned 
> to the other type, subject to truncation conditions
> {noformat}
> Thus i expect such expressions need to be processed correctly, but it fails:
> {noformat}
> create table tiny(v TINYINT);
> insert into tiny values(127);
> SELECT * FROM tiny WHERE v < '300';
> {noformat}
> {noformat}
> Caused by: org.apache.ignite.sql.SqlException: IGN-SQL-5 
> TraceId:cfce3f69-606e-482b-b267-260f8569df62 Value '300' out of range for 
> type TINYINT
>       at 
> org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.literalCanFitType(IgniteSqlValidator.java:714)
>       at 
> org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.checkTypesInteroperability(IgniteSqlValidator.java:680)
>       at 
> org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.deriveType(IgniteSqlValidator.java:550)
> {noformat}
> Check: AbstractTypeCoercion#commonTypeForBinaryComparison



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

Reply via email to