This what I got when I updated the module

user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE image_attach DROP PRIMARY KEY in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\...\includes\database.mysql-common.inc on line 386.
user warning: Can't DROP 'iid'; check that column/key exists query: ALTER TABLE image_attach DROP INDEX iid in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\....\includes\database.mysql-common.inc on line 448.
user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE image DROP PRIMARY KEY in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\...\includes\database.mysql-common.inc on line 386.
user warning: Duplicate entry '76-thumbnail' for key 1 query: ALTER TABLE image ADD PRIMARY KEY (nid, image_size) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\...\includes\database.mysql-common.inc on line 374.
user warning: Can't DROP 'image_fid'; check that column/key exists query: ALTER TABLE image DROP INDEX image_fid in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\...\includes\database.mysql-common.inc on line 448.

The following queries were executed
image_attach module
Update #6100
ALTER TABLE {image_attach} CHANGE nid `nid` INT unsigned NOT NULL DEFAULT 0
ALTER TABLE {image_attach} CHANGE iid `iid` INT unsigned NOT NULL DEFAULT 0
Failed: ALTER TABLE {image_attach} DROP PRIMARY KEY
ALTER TABLE {image_attach} ADD PRIMARY KEY (nid)
Failed: ALTER TABLE {image_attach} DROP INDEX iid
ALTER TABLE {image_attach} ADD INDEX iid (iid)
image module
Update #6100
ALTER TABLE {image} CHANGE nid `nid` INT unsigned NOT NULL DEFAULT 0
ALTER TABLE {image} CHANGE fid `fid` INT unsigned NOT NULL DEFAULT 0
Failed: ALTER TABLE {image} DROP PRIMARY KEY
Failed: ALTER TABLE {image} ADD PRIMARY KEY (nid, image_size)
Failed: ALTER TABLE {image} DROP INDEX image_fid
ALTER TABLE {image} ADD INDEX fid (fid)
Update #6101
No queries
Update #6102
No queries

How serious this is?
What should I do?

Comments

Morn’s picture

Same at my site:

    * user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE image DROP PRIMARY KEY in /home/www/test/vtad/includes/database.mysql-common.inc on line 386.
    * user warning: Can't DROP 'image_fid'; check that column/key exists query: ALTER TABLE image DROP INDEX image_fid in /home/www/test/vtad/includes/database.mysql-common.inc on line 448.

Update #6100

    * ALTER TABLE {image} CHANGE nid `nid` INT unsigned NOT NULL DEFAULT 0
    * ALTER TABLE {image} CHANGE fid `fid` INT unsigned NOT NULL DEFAULT 0
    * Failed: ALTER TABLE {image} DROP PRIMARY KEY
    * ALTER TABLE {image} ADD PRIMARY KEY (nid, image_size)
    * Failed: ALTER TABLE {image} DROP INDEX image_fid
    * ALTER TABLE {image} ADD INDEX fid (fid)
dsy73’s picture

You can ignore these warnings as said here:
http://drupal.org/node/479964

lhugg’s picture

Should we bother to run the UPDATE, or just run it and ignore these DROP errors?

bryrock’s picture

I'm taking this back. I now believe the problem is with Taxonomy Image, itself. I rolled it back to a previous version and it works with the updated Image module, no problems.

Please ignore the following:
I ran the update and ignored the errors, and now I'm getting errors from the taxonomy_image module whenever it tries to do the getimagesize function. This blows up pages that were working prior to the update.

Here is the error:

warning: getimagesize(http://beta.johnnyguitars.com/sites/default/jgfiles/category_pictures/si...) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/johnnyguitar/drupal/sites/all/modules/taxonomy_image/taxonomy_image.module on line 267.

I'll note that the url in the error does not make sense, and that could be part of this particular problem, and this comes from the Taxonomy Image Attach module which depends on Image and Image Attach, but, again, this worked prior to updating Image.

alison’s picture

I got the same errors as others here, and I don't have Taxonomy Image. That said, I looked at the Issue page linked to above, and I'll be ignoring the errors as suggested :)

VinceW’s picture

As a follow up of the before mentioned (but closed) issue #479964: Can't DROP primary key/index in database update

@sun wrote in #1

You can safely ignore this error. As of now, we cannot prevent it from happening, because Drupal core does not provide methods to get defined primary key and indexes of a database table.

This is something I'm puzzled about. I don't like to ignore error messages (in applications :-) ), so this remark was a trigger for me to dive into some searching work on this topic.

I noticed it's pretty easy in mysql to find a primary key of a table with the command: SHOW INDEX FROM image WHERE key_name LIKE("PRIMARY");
With this it should not be so hard to write a small function which checks if a primary key exists in a table.

But, perhaps am I missing something and is there a special reason why drupal core doesn't provide methods to get a primary key of a table? I couldn't find anything about it in the issue queues of the database system.

Can you fill me in on some blanks I might have on this, before I walk over to the database.core to submit some code for this?

Best,
VinceW

-=[ Your Information Matters ]=-

FYI: I got the error message when updating to version 6.x-1.0-alpha5. I've attached the error log.

alison’s picture

I've since had actual problems with the image module - just thought I'd comment here, sort of as an update to my previous comment... Maybe this error message isn't quite so benign? I'm not sure, but I detailed my problem here http://drupal.org/node/522806

lhugg’s picture

My client also informed me that now any images that were placed with Image Assist don't show as images in edit mode anymore, just the text of the imageassist node link. This was not the case before the update -- I wonder if it could be related. Not trying to point fingers, just doing the usual diagnostic process of asking "what has changed since it last worked?". Having unexplained error messages is always uncomfortable. I hope it's not this, because rolling back would be problematic at this point.

AdrianB’s picture

I got these errors as well. So I went ahead and performed some of these commands manually (like "ALTER TABLE image DROP PRIMARY KEY"). But maybe I shouldn't have done this?

Edit: Nevermind, I reran update #6100 again.

ramones79’s picture

Same errors on my site. Re-run the update.php - and no errors this time. Available updates shows that the module is successfully updated /shows that Drupal is using the new version/. No problems with the website found. /and hopefully none will show up/

sun’s picture

Status: Active » Closed (duplicate)

Thanks for taking the time to report this issue.

However, marking as duplicate of #479964: Can't DROP primary key/index in database update. Please search for existing issues before submitting a new one.