[
https://issues.apache.org/jira/browse/CALCITE-5901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17751412#comment-17751412
]
Mihai Budiu commented on CALCITE-5901:
--------------------------------------
I found this documentation for Oracle DECIMAL data type:
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Data-Types.html#GUID-75209AF6-476D-4C44-A5DC-5FA70D701B78,
which explains what a SCALE > PRECISION can mean:
> Scale can be greater than precision, most commonly when e notation is used.
> When scale is greater than precision, the precision specifies the maximum
> number of significant digits to the right of the decimal point. For example,
> a column defined as NUMBER(4,5) requires a zero for the first digit after the
> decimal point and rounds all values past the fifth digit after the decimal
> point.
So I will close this issue.
> 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)