Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 30547 invoked from network); 20 Sep 2006 16:02:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Sep 2006 16:02:03 -0000 Received: (qmail 62117 invoked by uid 500); 20 Sep 2006 16:02:03 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 62090 invoked by uid 500); 20 Sep 2006 16:02:03 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 62081 invoked by uid 99); 20 Sep 2006 16:02:03 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Sep 2006 09:02:03 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [209.237.227.198] ([209.237.227.198:51070] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 3F/D5-01963-AF561154 for ; Wed, 20 Sep 2006 09:02:02 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 50DFC7142FB for ; Wed, 20 Sep 2006 15:58:25 +0000 (GMT) Message-ID: <12498334.1158767905328.JavaMail.jira@brutus> Date: Wed, 20 Sep 2006 08:58:25 -0700 (PDT) From: "Kristian Waagan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-1495) Attempt to modify an identity column error after resetting identity column In-Reply-To: <11847236.1152568289866.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1495?page=3Dcomments#actio= n_12436264 ]=20 =20 Kristian Waagan commented on DERBY-1495: ---------------------------------------- Thanks Bryan. I have been able to determine what seems to be causing the problem, but hav= e not yet understood how to fix it. This is my first venture into the this = area of the code, so things are very unclear to me. First, after studying the various variables describing an identity column, = I noticed that if the DefaultInfo assoiciated with an identity column is nu= ll, the column is said to be "generated always as identity". In effect, the= column definition is changed after the restart/increment operation, becaus= e the defaultInfo is set to null. This can be observed with the new describ= e command in ij. Bryan's guess seems to be valid, but if I add the old DefaultInfoImpl insta= nce to the new one, I get a NPE when doing a drop on the table the next tim= e I boot the database. It happens for 'BasicDependencyManager.clearDependen= cies'. It also happens if I create a new instance (new DefaultInfoImpl(true= ,null,null)) and add it to the newly created ColumnDescriptor. This piece o= f the code is in AlterTableConstantAction.modifyColumnDefault, as Bryan men= tioned. Is the error in this method, or does it happen earlier so the input is not = as expected? What step have I forgotten to do? I'll keep looking into this, but any piece of further advice is appreciated= ! > Attempt to modify an identity column error after resetting identity colum= n > -------------------------------------------------------------------------= - > > Key: DERBY-1495 > URL: http://issues.apache.org/jira/browse/DERBY-1495 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.0 > Environment: Java 1.5.0_06-b05 on Linux Ubuntu 5.10. Derby versio= n 10.2.0.3-412239 > Reporter: Lars Gr=C3=A5mark > Priority: Minor > > When an identity counter is altered using the ALTER TABLE statement below= , it seems as if the GENERATED BY DEFAULT behavior is lost. > The following statements will reproduce the error. > CREATE TABLE MYTABLE ( > id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1= ) NOT NULL > ,col2 INT NOT NULL > ) > -- Insert using an explicit value on the ID-field > INSERT INTO MYTABLE(ID, COL2) VALUES(2, 2) > -- Reset the identity field > ALTER TABLE mytable ALTER COLUMN id RESTART WITH 3 > -- Try inserting another explicit value and the error below is thrown. > INSERT INTO MYTABLE(ID, COL2) VALUES(4, 4) > Error: SQL Exception: Attempt to modify an identity column 'ID'. , SQL St= ate: 42Z23, Error Code: 30000 > -- Although, this works fine > INSERT INTO MYTABLE(COL2) VALUES(4) --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= p://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira