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

Julian Hyde commented on CALCITE-5901:
--------------------------------------

This bug is a misreading of the standard. The standard says what statements a 
conforming implementation shall accept, not what it shall deny. Calcites 
behavior is intentional, consistent with other systems (eg Oracle), and useful. 

> Compiler should not accept DECIMAL types with precision < scale
> ---------------------------------------------------------------
>
>                 Key: CALCITE-5901
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5901
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> The following test, when added to to SqlOperatorTest, passes:
> {code:java}
> f.checkScalar("cast(0.012 as DECIMAL(2, 5))", new  BigDecimal("0.012"), 
> "DECIMAL(2, 5) NOT NULL");
> {code}
> However, according to the SQL standard "The <scale> of an <exact numeric 
> type> shall not be greater than the <precision> of the <exact numeric type>." 
> In this case the precision is 2 and the scale is 5.
> So I would expect this test to fail. The validator should reject such types. 
> I think that this change would affect quite a few tests.



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

Reply via email to