[ https://issues.apache.org/jira/browse/IGNITE-19947?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maksim Zhuravkov updated IGNITE-19947: -------------------------------------- Description: CAST(n AS DECIMAL(p, s) always returns `numeric field overflow` error when s > p which is not correct, in such case we should also check `n`. Example: {code:java} SELECT CAST (? AS DECIMAL(1,4)) ? = 0.0001 # PG returns 0.0001 # Ignite 3 returns numeric field overflow {code} Query with a literal works because calcite performs constant folding and removes a CAST call. was: CAST(n AS DECIMAL(p, s) always returns `numeric field overflow` error when s > p which is not correct, in such case we should also check `n`. Example: {code:java} SELECT CAST (0.0001 AS DECIMAL(1,4)) # PG returns 0.0001 # Ignite 3 returns numeric field overflow {code} > Sql. Fix CAST(n AS DECIMAL(precision, scale) behaviour for scale > precision. > ----------------------------------------------------------------------------- > > Key: IGNITE-19947 > URL: https://issues.apache.org/jira/browse/IGNITE-19947 > Project: Ignite > Issue Type: Bug > Components: sql > Affects Versions: 3.0.0-beta1 > Reporter: Maksim Zhuravkov > Assignee: Evgeny Stanilovsky > Priority: Minor > Labels: ignite-3 > > CAST(n AS DECIMAL(p, s) always returns `numeric field overflow` error when s > > p which is not correct, in such case we should also check `n`. > Example: > {code:java} > SELECT CAST (? AS DECIMAL(1,4)) ? = 0.0001 > # PG returns 0.0001 > # Ignite 3 returns numeric field overflow > {code} > Query with a literal works because calcite performs constant folding and > removes a CAST call. -- This message was sent by Atlassian Jira (v8.20.10#820010)