db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-167) Inserting values in an identity column
Date Sun, 03 Apr 2005 13:56:17 GMT
     [ http://issues.apache.org/jira/browse/DERBY-167?page=comments#action_62045 ]
     
Kathey Marsden commented on DERBY-167:
--------------------------------------

By adding the GENERATED BY DEFAULT syntax, users could load their data and continue adding
new items by being careful to specify the correct START WITH value when creating the table.

ij> create table t4 (id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 4) CONSTRAINT
id_pk PRIMARY KEY, stuff VARCHAR(30));
0 rows inserted/updated/deleted
ij> -- load my old data
insert into t4 values(1,'mystuff1');
1 row inserted/updated/deleted
ij> insert into t4 values(2,'mystuff2');
1 row inserted/updated/deleted
ij> insert into t4 values(3,'mystuff3');
1 row inserted/updated/deleted
ij> -- have a new item
insert into t4(stuff) values('mystuff4');
1 row inserted/updated/deleted
ij> select * from t4;
ID         |STUFF
------------------------------------------
1          |mystuff1
2          |mystuff2
3          |mystuff3
4          |mystuff4

4 rows selected
ij>


> Inserting values in an identity column
> --------------------------------------
>
>          Key: DERBY-167
>          URL: http://issues.apache.org/jira/browse/DERBY-167
>      Project: Derby
>         Type: Improvement
>   Components: SQL
>     Versions: 10.1.0.0
>  Environment: SQL
>     Reporter: Christian Rodriguez

>
> It is not possible to insert a specific value in a column defined as identity. This makes
it very hard to migrate from other RDBMSs or to import data dumped from other databases. 
> For example, an autoincrement column in MySQL should be an identity column. The problem
is that when the data is dumped from MySQL to a file, it generates inserts with values. These
values cant be inserted in the Derby table. 
> Posible solutions: 1. being able to "generate by default as identity" 2. being able to
disable the "identity" feature for a column 3. being able to generate a column as non identity
and after data is populated, alter table to add the "identity" to the column.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message