From derby-user-return-14961-apmail-db-derby-user-archive=db.apache.org@db.apache.org Wed Mar 27 03:11:07 2013 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 CD261F3BA for ; Wed, 27 Mar 2013 03:11:07 +0000 (UTC) Received: (qmail 44149 invoked by uid 500); 27 Mar 2013 03:11:07 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 43982 invoked by uid 500); 27 Mar 2013 03:11:06 -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 43964 invoked by uid 99); 27 Mar 2013 03:11:05 -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 03:11:05 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,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 03:10:59 +0000 References: <1364343694121-128400.post@n7.nabble.com> User-Agent: Email for Android In-Reply-To: <1364343694121-128400.post@n7.nabble.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----N1QN5DO7TRPM3M6X5NAGVBLBUJD687" Subject: Re: IDENTITY fields as primary keys: inserts vs. system generated values From: George Sexton Date: Tue, 26 Mar 2013 21:10:34 -0600 To: Derby Discussion Message-ID: X-Virus-Checked: Checked by ClamAV on apache.org ------N1QN5DO7TRPM3M6X5NAGVBLBUJD687 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a command to update the identity value after a load. I don't recall it exactly, and I am away from my computer. I will mail the solution in the morning. Sent from my Kindle Fire _____________________________________________ From: rgasch Sent: Tue Mar 26 18:21:34 MDT 2013 To: derby-user@db.apache.org Subject: IDENTITY fields as primary keys: inserts vs. system generated values 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. ------N1QN5DO7TRPM3M6X5NAGVBLBUJD687 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

There is a command to update the identity value after a load. I don't recall it exactly, and I am away from my computer. I will mail the solution in the morning.

Sent from my Kindle Fire




From: rgasch <rgasch@gmail.com>
Sent: Tue Mar 26 18:21:34 MDT 2013
To: derby-user@db.apache.org
Subject: IDENTITY fields as primary keys: inserts vs. system generated values

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
besi de 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.

------N1QN5DO7TRPM3M6X5NAGVBLBUJD687--