1. CCK version : 5.x-1.9
2. imagefield version : 5.x-2.5
3. permissions for your tmp and files directory. : 755
4. download method (public or private files) : public

When I've tried to upgrade from imagefield (Update 5) I got an error :

    * Failed: UPDATE content_field_image_1 SET field_image_1_fid = 0 WHERE field_image_1_fid NOT IN (SELECT fid FROM {files})
    * Failed: UPDATE content_field_gallery SET field_gallery_fid = 0 WHERE field_gallery_fid NOT IN (SELECT fid FROM {files})
    * Failed: UPDATE content_field_img SET field_img_fid = 0 WHERE field_img_fid NOT IN (SELECT fid FROM {files})

Also, got 3 warning that are related to error above is : (I just pick one since I think they all all the same.)

* user warning: Table 'main.content_field_gallery' doesn't exist query: UPDATE content_field_gallery SET field_gallery_fid = 0 WHERE field_gallery_fid NOT IN (SELECT fid FROM files) in /public_html/includes/database.mysql.inc on line 174.

Imagefield still works fine with that failed update.

CommentFileSizeAuthor
#4 imagefield5_update_brackets.patch766 bytesquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Thanks for your report. I tested this out several times and ImageField asks CCK directly for which tables to update, so it's strange that it would get back tables that were not valid.

Could you answer these questions that might help prevent the same error for others?

- How many ImageFields do you have on your site?
- Did some other similar updates complete from imagefield_update_5?
- In your database, are there tables of some similar names (content_field_image, perhaps?)
- Are there tables in the database with a similar name only prefixed with "node_" instead of "content_" (node_field_image_1)?

My guess is that you have some "orphaned" fields on your site that CCK expects there still to be tables for, but they're missing for some reason, but without the above information I can't tell for sure.

ariflukito’s picture

I have the same problem, in my case the table prefix doesn't get applied. If you see the OP's update statement, there is no curly bracket enclosing the table name.

quicksketch’s picture

Yep, I think you're right ariflukito: the same thing is going on in the FileField queue. #402912: SQL Error generated by update 6101 on upgrade

quicksketch’s picture

Status: Active » Fixed
FileSize
766 bytes

I've fixed this with that attached patch. For anyone that experienced this problem, it's highly encouraged to apply this patch, then run the ImageField update 5 again. See #310047: Field is not removed from shared content_field_XXX table on delete and #402424: Cleanup Abandoned Database Rows Left Over from D5.

quicksketch’s picture

Title: Update Database error » Update 5 Database Error if Using Table Prefix
abx’s picture

The update #5 from version 2.6 went through without any problem. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.