db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukas Eder (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-7009) DECIMAL(33, 3) Type cannot be used in CAST expression, but can appear in views
Date Wed, 26 Sep 2018 14:41:00 GMT

     [ https://issues.apache.org/jira/browse/DERBY-7009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lukas Eder updated DERBY-7009:
------------------------------
    Description: 
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.

 

  was:
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.

 


> 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
>            Priority: Major
>
> 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)

Mime
View raw message