You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kristian Waagan (JIRA)" <ji...@apache.org> on 2006/11/13 12:05:43 UTC

[jira] Commented: (DERBY-1495) Attempt to modify an identity column error after resetting identity column

    [ http://issues.apache.org/jira/browse/DERBY-1495?page=comments#action_12449313 ] 
            
Kristian Waagan commented on DERBY-1495:
----------------------------------------

I have tested/reviewed the patch, and was unable to find any problems. More specifically, I did not see the error I saw when trying to fix the bug. Although my approach were pretty much the same, I suspect I might have done what Bryan did somewhere else in the code path (and in that way made something go wrong).

I ran derbyall and suites.All with both Java SE 5 and 6. Only saw three known problems in derbyall (Compatibility and VerifySignatures).

Patch is small and clean, everything seems to work and testcases have been added.
+1 to commit

> Attempt to modify an identity column error after resetting identity column
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1495
>                 URL: http://issues.apache.org/jira/browse/DERBY-1495
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: Java 1.5.0_06-b05 on Linux Ubuntu 5.10. Derby version 10.2.0.3-412239
>            Reporter: Lars Gråmark
>         Assigned To: Bryan Pendleton
>            Priority: Minor
>         Attachments: preserveColDefault_v1.diff
>
>
> 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 State: 42Z23, Error Code: 30000
> -- Although, this works fine
> INSERT INTO MYTABLE(COL2) VALUES(4)

-- 
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