db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George S." <geor...@mhsoftware.com>
Subject Re: IDENTITY fields as primary keys: inserts vs. system generated values
Date Wed, 27 Mar 2013 14:42:51 GMT
FWIW, on SQL Server, you have to do a DBCC CHECKIDENT command, and on 
PostgreSQL, you do an ALTER SEQUENCE x RESTART WITH command.



On 3/26/13 6:21 PM, rgasch wrote:
> I'm in the process of porting an application to derby and I've hit a major
> stumbling block in the sense that we're using a SQL script to populate our
> database. Since we have columns declared as
>    id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY
> and
>    PRIMARY KEY (id)
> we're hitting the situation that in our application inserts fail since the
> system generated IDs are already taken by the IDs claimed by our SQL load.
>
> I've found the following thread related to this
>   
> http://apache-database.10148.n7.nabble.com/quot-generated-by-default-quot-question-tt98475.html
>
> I understand the arguments made in the thread that this is not a bug but
> rather a feature (I'm not saying I'm agreeing with this notion but that's
> beside the point). But since this thread is from 2006, I was wondering if in
> the meantime some sort of solution has been added to derby to gracefully
> avoid generating already used sequence numbers?
>
> Can someone who's in the know confirm or deny this?
>
> Greetings/Thanks
> Robert
>
>
>
>
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/IDENTITY-fields-as-primary-keys-inserts-vs-system-generated-values-tp128400.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
>

-- 
George Sexton
MH Software, Inc.
303 438-9585
http://www.mhsoftware.com/


Mime
View raw message