[ 
https://issues.apache.org/jira/browse/DERBY-3177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540962
 ] 

Bryan Pendleton commented on DERBY-3177:
----------------------------------------

Unfortunately, I can't think of an easy way to repair the SYSCOLUMNS corruption.
I believe that the essence of the corruption is that the AUTOINCREMENTVALUE  ,
AUTOINCREMENTSTART , and AUTOINCREMENTINC columns of the
SYS.SYSCOLUMNS row for the "ID" column of the "MESSAGES" table have been 
erroneously set to NULL, when they should have the values as described in
http://db.apache.org/derby/docs/10.3/ref/rrefsistabs22441.html

Unfortunately, trying to issue an UPDATE statement against SYS.SYSCOLUMNS
to repair the damage produces the error:

ERROR 42Y25: 'SYS.SYSCOLUMNS' is a system table.  Users are not allowed to 
modify the contents of this table.

and I don't know how to get around this error.

So you may need to either restore your database from a backup, or 
export the data and re-import it, after dropping and re-creating the table.

Perhaps somebody else can think of an alternate way to repair the table,
and will post it.


> Dropping columns casues auto_increment field to be lost
> -------------------------------------------------------
>
>                 Key: DERBY-3177
>                 URL: https://issues.apache.org/jira/browse/DERBY-3177
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.1.4
>         Environment: Windows XP SP2
> JVM: Hotspot JVM 1.6
> Derby: 10.3.1000004.561794
>            Reporter: Charlie Hubbard
>            Assignee: Bryan Pendleton
>         Attachments: bug2.sql, migration-bug.sql
>
>
> I have a DB that I've been updating over time, and I've run into this bug.  
> After running this script Messages.ID table looses it's auto incrementing 
> column after running the script to completion.  If I create a virgin DB and 
> run this script against the Message table's ID column looses it's auto 
> increment data type.  If you comment out the last three alter table 
> statements the column's auto increment feature is not lost.  You don't have 
> to insert any data into the database for this to happen.
> I tried creating a simpler script to expose this problem, but was 
> unsuccessful.  I tried something like:
> create table Messages ( 
>   Name varchar(256), 
>   KillThis varchar(256),
>   id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT 
> BY 1), 
>   CONSTRAINT MESSAGES_id_pk PRIMARY KEY(id) 
> );
> alter table Messages drop column KillThis;
> However, this DID NOT EXPOSE THE BUG.  So there is something else at work 
> causing this problem.  See the attached script to recreate the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to