
|
If you were logged in you would be able to see more operations.
|
|
|
|
File Attachments:
|
|
|
Environment:
|
Java 1.5.0_06-b05 on Linux Ubuntu 5.10. Derby version 10.2.0.3-412239
|
|
Issue Links:
|
Duplicate
|
|
|
|
This issue is duplicated by:
|
|
DERBY-1645
ALTER TABLE ... SET INCREMENT BY X... Turns off the "Generated By Default" identity column constraint
|
|
|
|
|
|
|
| Resolution Date: |
13/Nov/06 08:38 PM
|
|
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)
|
|
Description
|
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) |
Show » |
made changes - 19/Oct/06 09:54 AM
| Field |
Original Value |
New Value |
|
Link
|
|
This issue is duplicated by DERBY-1645
[ DERBY-1645
]
|
made changes - 09/Nov/06 10:48 PM
|
Assignee
|
|
Bryan Pendleton
[ bryanpendleton
]
|
made changes - 12/Nov/06 12:36 AM
made changes - 12/Nov/06 12:36 AM
|
Derby Info
|
|
[Patch Available]
|
made changes - 13/Nov/06 08:38 PM
|
Fix Version/s
|
|
10.3.0.0
[ 12310800
]
|
|
Derby Info
|
[Patch Available]
|
|
|
Status
|
Open
[ 1
]
|
Resolved
[ 5
]
|
|
Resolution
|
|
Fixed
[ 1
]
|
made changes - 15/Nov/06 03:20 PM
|
Fix Version/s
|
|
10.2.1.8
[ 12312096
]
|
made changes - 13/Dec/07 09:05 AM
|
Status
|
Resolved
[ 5
]
|
Closed
[ 6
]
|
|