You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Lukas Eder (JIRA)" <ji...@apache.org> on 2018/09/26 14:41:00 UTC

[jira] [Created] (DERBY-7009) DECIMAL(33, 3) Type cannot be used in CAST expression, but can appear in views

Lukas Eder created DERBY-7009:
---------------------------------

             Summary: DECIMAL(33, 3) Type cannot be used in CAST expression, but can appear in views
                 Key: DERBY-7009
                 URL: https://issues.apache.org/jira/browse/DERBY-7009
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.14.2.0
            Reporter: Lukas Eder


In the manual, there is a claim that the maximum precision for the DECIMAL data type is 31:
{quote}The _precision_ must be between 1 and 31. The _scale_ must be less than or equal to the precision.
{quote}
[https://db.apache.org/derby/docs/10.14/ref/rrefsqlj15260.html]

This can be confirmed via the following failing statements:

{{CREATE TABLE test (i decimal(33, 3));}}
{{SELECT cast(123.45 AS decimal(33, 3)) FROM sysibm.SYSDUMMY1;}}

However, this statement works:

{{CREATE VIEW x(a, b) AS }}
{{select 123456789012345678901234567890.001, 123456789012345678901234567890.001 from SYSIBM.SYSDUMMY1;}}

And a quick query against the dictionary views shows that the type is definitely DECIMAL(33, 3):

{{SELECT COLUMNDATATYPE}}
{{FROM SYS.SYSCOLUMNS}}
{{WHERE COLUMNNAME IN ('A', 'B');}}

Yielding:

{{COLUMNDATATYPE         |}}
{{-----------------------|}}
{{DECIMAL(33,3) NOT NULL |}}
{{DECIMAL(33,3) NOT NULL |}}

For consistency reasons, the latter should fail just like the former two.

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)