Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 75461 invoked from network); 4 Aug 2006 17:42:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Aug 2006 17:42:51 -0000 Received: (qmail 50310 invoked by uid 500); 4 Aug 2006 17:42:50 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 50275 invoked by uid 500); 4 Aug 2006 17:42:50 -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 50266 invoked by uid 99); 4 Aug 2006 17:42:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Aug 2006 10:42:50 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UPPERCASE_25_50 X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Aug 2006 10:42:50 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CF1547142B7 for ; Fri, 4 Aug 2006 17:40:13 +0000 (GMT) Message-ID: <20923872.1154713213830.JavaMail.jira@brutus> Date: Fri, 4 Aug 2006 10:40:13 -0700 (PDT) From: "Alan Baldwin (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Created: (DERBY-1645) ALTER TABLE ... SET INCREMENT BY X... Turns off the "Generated By Default" identity column constraint MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ALTER TABLE ... SET INCREMENT BY X... Turns off the "Generated By Default" identity column constraint ----------------------------------------------------------------------------------------------------- Key: DERBY-1645 URL: http://issues.apache.org/jira/browse/DERBY-1645 Project: Derby Issue Type: Bug Components: SQL Affects Versions: 10.1.3.1, 10.1.3.0 Environment: Both Ubuntu Linux, Windows XP... Java 1.4.2_x and Java 1.5 Reporter: Alan Baldwin I have a table which has an auto-generated key: create table MyTable ( TableId INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, StringValue VARCHAR(20) not null, constraint PK_MyTable primary key (TableId) ) I verify that GENERATED BY DEFAULT is set: SELECT * FROM sys.syscolumns col INNER JOIN sys.systables tab ON col.referenceId = tab.tableid WHERE tab.tableName = 'MYTABLE' AND ColumnName = 'TABLEID' I'm pulling in data for which I need to preserve the ID's: INSERT INTO MYTABLE (TableId, StringValue) VALUES (1, 'test1') INSERT INTO MYTABLE (TableId, StringValue) VALUES (2, 'test2') INSERT INTO MYTABLE (TableId, StringValue) VALUES (3, 'test3') In the absense of the Derby 10.2 feature (ALTER TABLE WITH RESTART X), I try to just change the INCREMENT BY value and insert a row so that I can reset the "next" key value: ALTER TABLE MyTable ALTER TableId SET INCREMENT BY 50 Then I insert a "dummy" record (which I will delete later...) to move the key upwards: INSERT INTO MYTABLE (StringValue) VALUES ('test53') However, I can now no longer insert explicit values into the primary key like this: INSERT INTO MYTABLE (TableId, StringValue) VALUES (-999, 'test3') I get this error: SQL Exception: Attempt to modify an identity column 'TABLEID'. Upon checking the sys.syscolumns table again, it verifies that the table no longer has an auto-generated key, but the TableId is still an identity column. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira