Closed (duplicate)
Project:
Drupal core
Version:
5.x-dev
Component:
database system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 May 2006 at 07:40 UTC
Updated:
15 Jan 2007 at 21:34 UTC
I get the following errors when running update.php, going from 4.7.0 to 4.7.1
- Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE node DROP PRIMARY KEY
- Multiple primary key defined query: ALTER TABLE node ADD PRIMARY KEY (nid, vid)
system_update_180() has:
$ret[] = update_sql("ALTER TABLE {node} DROP PRIMARY KEY");
$ret[] = update_sql("ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)");
If I restore the database back to the 4.7.0 version, and I do the intended change under phpmyadmin, it combines the sql into a single ALTER TABLE statement:
ALTER TABLE node DROP PRIMARY KEY, ADD PRIMARY KEY (nid, vid)
Which produces no error.
Database is Mysql 4.1.19
Comments
Comment #1
asimmonds commentedIf I change the order of the node table changes in update_180, from:
to: (adding the nid index before dropping the primary key)
and run the update on a restored 4.7.0 db, then no error is produced.
Comment #2
beginner commentedI just upgraded two different sites with mysql 4.0 and I didn't get any error, so your 4.1 version must matter.
Also, we have two mysql files to import during istallation, one 4.0 and one 4.1, but when the site is running, we're only running "mysql" so that the upgrade script doesn't know which version we use...
we currently have:
but we can't have:
So, your issue is a symptom of a wider issue.
Comment #3
gerhard killesreiter commentedI had tried the update on 4.1 and didn't get any errors either.
Comment #4
bwynants commentedsame errors here
Comment #5
jwilde commentedsame here
Comment #6
beginner commented@killes: ok, but the limitation I mentionned remains.
@Bert and jwilde: can you give more details, so that we can get a chance of figuring out what's the common denominator between you guys? :)
Comment #7
jwilde commentedSimple update from a ten day old cvs version of drupal to 4.7.1. For primary keys in the header I get 'array' for all the prime links.
For each node I get the less than sign '<' for each module link, say bookmarks, email this page, tags, print, etc. on the bottom of the post. I hope this helps.
Jim
Comment #8
jwilde commentedmy post got cut off.
I was saying, at the bottom of each post, I get the less than sign in place of links for email this page, print, tags, etc.
Comment #9
beginner commentedActually, what I am now wondering is why me, killes, and many others don't have any error: we should have!
The error you're referring to is mysql error:1075
http://dev.mysql.com/doc/refman/4.1/en/error-messages-server.html
and is a legitimate one.
the problem and the fix is the same as reported above and can be also found in the last comment of the following page:
http://dev.mysql.com/doc/refman/4.1/en/alter-table.html
I start to believe that there is a difference in the level of error reporting: developpers should use a stricter level reporting setting in order to avoid such problem (it reminds me of E_ALL). The problem is that I don't know where such settings are situated and how to change them.
Since the beginning of this thread, I have upgraded 3 more sites, the first without the fix, and the other two with the fix. I didn't see any difference. But looking at the table {node} in phpmyadmin for each of the sites I have upgraded, I found out that before the upgrade, they all had:
More than one INDEX key was created for column `status`and after the upgrade, they all have:
Comment #10
satori1984 commentedSame error here:
Update #180
Running Drupal 4.7 on PHP5 / MySQL 4.0.24
Comment #11
satori1984 commentedI did a dbase-restore, edited database/updates.inc as mentioned in asimmonds' post, and re-ran update.php, and this time no more errors...
Comment #12
rjleigh commentedI had the same error using mySQL v4.1.12a and PHP v4.4.2. This on a vanilla (basically empty, just one page and admin account) 4.7.0 db.
Made the change suggested in #1 submitted by asimmonds, and no error.
So, I guess it's ok?
Comment #13
pwolanin commentedEven before upgrading to 4.7.1, I'm seeing in phpmyadmin lots of error messages as described in #9 above. Where, the primary key is (nid,vid) but each of these is also set to be an index. Why do these need to be separately indexed if they are part of the primary index?
Comment #14
pwolanin commentedWith mysql 4.1.18, PHP 4.4.2 I do not get any error messages upgrading to 4.7.1.
Same with a different site with mysql 4.0.27, PHP Version 4.4.2
Comparing version numbers with posts above, are their relevant differences from mysql 4.1.1 to mysql 4.1.18 or from 4.0.24 to 4.0.27?
Comment #15
asimmonds commentedAfter some more experimenting, I'm pretty certain the problem is with Mysql table types.
The Drupal instance that I initially had the error with, has had it's tables converted to the InnoDB engine for some performance testing.
Created two Drupal 4.7.0 instances, one MyISAM, the other InnoDB based. Then upgraded both to 4.7.1. The MyISAM-based one upgraded without errors, while the InnoDB-based one produced the primary key error.
Testing environment: Win32 / Mysql 4.1.19 / PHP 5.1.4
Initial problem environment was: Linux / Mysql 4.1.19 / PHP 4.4.2
Comment #16
Kitchen commentedReading the comments, I'm wondering is this is an error or not. The message I got was similar, but did not say 'failure.' If this is an error, is there a fix? Other than the message below, things seem to be functioning properly (so far).
The following queries were executed
system module
Update #180
ALTER TABLE {node} DROP PRIMARY KEY
ALTER TABLE {node} ADD PRIMARY KEY (nid, vid)
ALTER TABLE {node} ADD UNIQUE (vid)
ALTER TABLE {node} ADD INDEX (nid)
ALTER TABLE {node_counter} CHANGE nid nid INT(10) NOT NULL DEFAULT '0'
Update #181
ALTER TABLE {profile_fields} ADD autocomplete TINYINT(1) NOT NULL AFTER visibility ;
Update #182
No queries
Comment #17
gregoryo commentedSee: http://drupal.org/node/63785
Same problem reported May 15, 2006 as
"system_update_180 error - upgrading from 4.5 to 4.7 - Can't DROP 'vid'."
Apache 2.0.51, php 4.3.11, and mysql 3.23.58
edited updates.inc with changes in item #1 above
reloaded database applied updates.php
with no problems now.
Comment #18
gtcaz commentedI see these errors even though I installed from the current CVS.
Problems with indexes of table `node`
PRIMARY and INDEX keys should not both be set for column `nid`
More than one INDEX key was created for column `status`
Problems with indexes of table `term_hierarchy`
PRIMARY and INDEX keys should not both be set for column `tid`
Problems with indexes of table `term_node`
PRIMARY and INDEX keys should not both be set for column `tid`
Should this be fixed?
Comment #19
beginner commentedComment #20
magico commentedSupport request until further development, with a concise identification and problem reproduction.
Comment #21
magico commentedDuplicate of http://drupal.org/project/node/76040