Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 63418 invoked from network); 22 Feb 2005 19:39:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 22 Feb 2005 19:39:45 -0000 Received: (qmail 22170 invoked by uid 500); 22 Feb 2005 19:39:44 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 22143 invoked by uid 500); 22 Feb 2005 19:39:44 -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 22127 invoked by uid 99); 22 Feb 2005 19:39:44 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from web53007.mail.yahoo.com (HELO web53007.mail.yahoo.com) (206.190.39.197) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 22 Feb 2005 11:39:42 -0800 Received: (qmail 54270 invoked by uid 60001); 22 Feb 2005 19:39:40 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=ycLUraNPsk8FHFy6/hkMqeNFiflJp+kKy9oCKakXGMQhqJxLTjphuuklBZeRNCYlqATCJRH48XHvEESzNY8jpxJLbV4nVCz/gNL9Ndx1SCS9SO8hWlhJa6YHoJ1wH83w/rNWAWLfYCZuoEvgsLhO5qozQW4P/AD90pQNYlIgpbg= ; Message-ID: <20050222193940.54268.qmail@web53007.mail.yahoo.com> Received: from [129.42.184.35] by web53007.mail.yahoo.com via HTTP; Tue, 22 Feb 2005 11:39:39 PST Date: Tue, 22 Feb 2005 11:39:39 -0800 (PST) From: Suavi Ali Demir Subject: Re: identity column causes grief when populating table - suggestions? To: Derby Discussion In-Reply-To: <421B8A3F.2090908@protocool.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Will derby support "default" keyword as in: create table a( id int not null generated by DEFAULT as identity, ... or something like that? That would solve these problems as it would only generate values if we do not specify the value. Regards, Ali --- Trevor Squires wrote: > Hi, > > I've been googling all morning and can't find info > to solve this problem > (using derby of course), I hope someone here can > help... > > As I write my application I have a script which > blats and recreates my > database and then populates the tables with test > data. > > However, many of my tables have identity columns and > it's causing the > following error when I insert the data: > > 11:06:26 [INSERT - 0 row(s), 0.016 secs] [Error > Code: 30000, SQL > State: 42Z23] Attempt to modify an identity column > 'ID'. > > Here's my table: > > create table sample ( > id int not null generated always as identity, > description varchar(128) not null, > quantity double not null, > constraint product_pk primary key (id) > ); > > Here's my insert statement > > insert into sample (ID, DESCRIPTION, QUANTITY) > values (1, 'blah', 1.1); > > I've tried to create the table without "generated > always as identity" > and then altering the table after the insert(s). > > Unfortunately I can't get the syntax right and I > can't figure out if > there's a way to turn off identity generation > temporarily. > > Does anyone have any suggestions like pointer to the > right way to do > this or a relatively painless workaround? > > Thanks for listening, > Trevor > >