Menu

Duplicate entry after upgrade

Help
Boyd Wold
2002-10-28
2002-10-28
  • Boyd Wold

    Boyd Wold - 2002-10-28

    This is a composite post.  It has my question, how I fixed it and then another question on learning a better way of fixing it.

    I was using version 0.7.0.  I decided to upgrade to 0.9.0.  This would involve moving to a dedicated computer.

    I had a number of problems in the install that took me 5 hours to figure out.  In the end I started over and installed a new copy which worked first time.  ???  I was extactic.

    After moving the bug_tracker database from the old computer to the new on and running the upgrade.php on it with success I was able to log in and see all the data that was in the old database.

    However, everytime I tried to do something that required a 'inser' on the mysql database I got the duplicate entry error.  I noticed that if I did a refresh that the ID value was incrementing by one.

    I looked in the database and found that that table had 340 entries and this was trying to do and 'inser' using the primary key 141.  As a test I hit refresh 160 times until that value was 341 and it entered it in just fine.

    Now, I have had to do this for each 'inser' (new bug, comments from and existing bug, new version).

    I can get it to work without problem after the 100's of refreshes but this doesn't seem like the best way to go about solving the problem. 

    Is there a better, more programtic way of setting the value?

     
    • Boyd Wold

      Boyd Wold - 2002-10-28

      Unsure why every time I type 'insert' it showed up as 'inser' in my previous post.  Sorry.  It should be 'INSERT'.

       
      • Benjamin Curtis

        Benjamin Curtis - 2002-10-28

        Yeah, upgrading over two releases is much more problematic than one.
        The problem you were having involved the move to sequences, and the id
        in the sequence table being out of sync with the number of entries in
        the master table.  You can get them in sync again by doing something
        like this:

        1. Find the max id used in the master table (let's use bug)
            select max(bug_id) from bug;
        2. Update the _seq table with this number
            update bug_seq set id = [result from previous query];

        That should save you from having to get a few hundred insert errors :)

         

Log in to post a comment.