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

Knut Anders Hatlen updated DERBY-5274:
--------------------------------------

    Attachment: derby-5274-1a-getColumns.diff

The bug in DESCRIBE is actually a bug in DatabaseMetaData.getColumns(). The SQL 
that generates the meta-data ResultSet attempts to cast the start value for the 
identity column to CHAR(12), which fails for these large values. A BIGINT can 
be up to 20 characters long.

Attached is a patch which fixes the bug by using the CHAR function instead of 
the CAST operator when building the meta-data. The CHAR function doesn't 
require a length argument, so we avoid hitting this limit.

> Cannot create tables correctly with auto generated identity columns that 
> start with large numbers
> -------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5274
>                 URL: https://issues.apache.org/jira/browse/DERBY-5274
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.7.1.1
>         Environment: Linux 10.3.
>            Reporter: Tony Brusseau
>            Priority: Critical
>         Attachments: derby-5274-1a-getColumns.diff
>
>
> CREATE TABLE kb.constant_term
> (
>         term_id                 BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY 
> (START WITH 648518346341351400, INCREMENT BY 1),
>         constant_name      VARCHAR(1024) NOT NULL
> );
> The above SQL causes the table to be created but no columns to be defined (no 
> error message is reported). If I change  648518346341351400 to a 0, then the 
> table is created normally with all the columns defined correctly.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to