Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D79BF2F9 for ; Wed, 27 Mar 2013 14:43:19 +0000 (UTC) Received: (qmail 97294 invoked by uid 500); 27 Mar 2013 14:43:19 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 97210 invoked by uid 500); 27 Mar 2013 14:43:18 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 97194 invoked by uid 99); 27 Mar 2013 14:43:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Mar 2013 14:43:18 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of georges@mhsoftware.com designates 209.169.14.178 as permitted sender) Received: from [209.169.14.178] (HELO mail.mhsoftware.com) (209.169.14.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Mar 2013 14:43:12 +0000 Message-ID: <5153056B.4060501@mhsoftware.com> Date: Wed, 27 Mar 2013 08:42:51 -0600 From: "George S." User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Derby Discussion Subject: Re: IDENTITY fields as primary keys: inserts vs. system generated values References: <1364343694121-128400.post@n7.nabble.com> In-Reply-To: <1364343694121-128400.post@n7.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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/