db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5274) Cannot create tables correctly with auto generated identity columns that start with large numbers
Date Tue, 14 Jun 2011 10:04:47 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049093#comment-13049093
] 

Knut Anders Hatlen commented on DERBY-5274:
-------------------------------------------

I tried the following with Derby 10.7.1.1, and the table seems to have been created with all
the expected columns and the correct start value:

ij version 10.7
ij> connect 'jdbc:derby:db;create=true';
ij> 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
);
0 rows inserted/updated/deleted
ij> insert into kb.constant_term values (default, 'abc'), (default, 'def');
2 rows inserted/updated/deleted
ij> select * from kb.constant_term;
TERM_ID             |CONSTANT_NAME                                                       
                                                           
-----------------------------------------------------------------------------------------------------------------------------------------------------
648518346341351400  |abc                                                                 
                                                           
648518346341351401  |def                                                                 
                                                           

2 rows selected

Are you doing something different when you see the problem?

I do see the bug in DESCRIBE:

ij> describe kb.constant_term;
ERROR 22001: A truncation error was encountered trying to shrink CHAR '648518346341351400'
to length 12.

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

        

Mime
View raw message