You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2023/08/06 18:28:00 UTC

[jira] [Created] (CALCITE-5901) Compiler should not accept DECIMAL types with precision < scale

Mihai Budiu created CALCITE-5901:
------------------------------------

             Summary: 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


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)