I'm having problems dropping primary keys and fields (columns) in MySQL. I think it could be related to the following note I found in the 5.1 Reference Manual.
Error on rename the table occurs also when you try to drop a primary key from the InnoDB table that is referenced by other tables (i.e. there exists a foreign key constraint that references the primary key you want to drop.) It's a pity that mysql doesn't report this error in more user friendly way.
The table in question is the filter table when attempting to run filter_update_7004. If this is the case then other update functions could be affected as well.
Comments
Comment #1
sunComment #2
damien tournoud commentedWaiting for someone to confirm the bug.
Comment #3
ctmattice1 commentedI also found this in the MySQL manaual, which may be more applicable to the primary key issue i'm experiencing
Comment #4
Crell commentedUgh. We tried to add proper schema builders, but didn't make it in by the initial code freeze. D7 doesn't support multiple schema changes in one command. We may need to replicate the table and then rename it. Yuck.
Comment #5
damien tournoud commentedCannot reproduce on MySQL 5.0. What we are actually doing here is dropping a whole autoincrement column, not a primary key:
Seems to work ok for me.
Comment #6
damien tournoud commentedIt would help if you could report the *exact and actual* error message you are experiencing.
Comment #7
ctmattice1 commentedWish I could Damien but the updates silently die and continues on with the next sequence.
Tables were not being changed. So I started to stepwise debug using
print "pass check point";die();That is how I found which update functions were dying on the vine. I've trace some of them down but will reinstall and run #734762: Upgrade path: tidy up the changes to filter and filter_format since that's where the update process was blowing up the worst.Comment #8
damien tournoud commentedOk, I'll convert this into a support request for now. Thanks for investigating that, it might be related to something specific about your environment (MySQL version, PHP version, etc.), so it might be useful to investigate all the possible causes.
At least, the two potential causes identified here (renaming a table pointed by a foreign key and removing a primary key that is an autoincrement) have been ruled out.
Comment #9
scor commentedThere is something I don't understand in filter_update_7004(): we do
db_add_primary_key('filter', array('format', 'name'));without dropping the primary_key first. According to mysql/schema.inc, this should throw an exception:Comment #10
ctmattice1 commentedFrom my understanding when you drop the auto increment field it removes the primary key as well.
Comment #11
kars-t commentedHi
I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.
Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.