After upgrading a D6 to D7 site. I get this error when trying to save an existing page on the site that has uploaded image files, and the page will not save. If I remove the uploaded files, the error goes away and I can save the page.

PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'field_upload_inline_image_width' at row 1: INSERT INTO {field_data_field_upload_inline_image} (entity_type, entity_id, revision_id, bundle, delta, language, field_upload_inline_image_fid, field_upload_inline_image_alt, field_upload_inline_image_title, field_upload_inline_image_width, field_upload_inline_image_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 37 [:db_insert_placeholder_2] => 25955 [:db_insert_placeholder_3] => page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 24 [:db_insert_placeholder_7] => NNSA Headquarters [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => ) in field_sql_storage_field_storage_write() (line 514 of /var/www/html/upgrade2a/modules/field/modules/field_sql_storage/field_sql_storage.module).

This is my table structure field_upload_inline_image, do i need to alter the Type or Null column?

entity_type (Primary) varchar(128)  No The entity type this data is attached to
bundle varchar(128) No The field instance bundle to which this row belongs, used when deleting a field instance
deleted (Primary) tinyint(4)    No 0 A boolean indicating whether this data item has been deleted
entity_id (Primary) int(10) No The entity id this data is attached to
revision_id int(10) Yes NULL The entity revision id this data is attached to, or NULL if the entity type is not versioned
language (Primary) varchar(32)  No The language for this data item.
delta (Primary) int(10) No The sequence number for this data item, used for multi-value fields
field_upload_inline_image_fid int(10)   Yes NULL The file_managed.fid being referenced in this field.
field_upload_inline_image_alt varchar(512)  Yes NULL Alternative image text, for the image’s ’alt’ attribute.
field_upload_inline_image_title varchar(1024)   Yes NULL Image title text, for the image’s ’title’ attribute.
field_upload_inline_image_width int(10) Yes NULL The width of the image in pixels.
field_upload_inline_image_height int(10)    Yes NULL

I'm using Media 7.x-1.5 Bundled with File entity 7.x-1.5. I am not using UUID module. maybe I need to then I will need the file_managed table is missing the uuid column

  • We are seeing the same effect for migrated numeric CCK fields with no default under postgre, it must have something to do with the upgraded settings, because newly created fields are not affected. Happens when a form field is left empty, such that the backend tries to insert a empty string '' into a numeric database column. For postgres, trying to set value '' into an integer column causes the same error message. It must have something to do with the configuration mapping the input html-field to it's storage type in the backend, but we haven't found it yet.
    – Michael
    Mar 13, 2016 at 15:11
  • Setting a default value in the field configuration for numeric fields is currently our workaround, but I don't know if that is possible in your case.
    – Michael
    Mar 13, 2016 at 15:15
  • Thanks. This was my fault. I was editing a page that had attached images. But the images were not in the /files folder! That was the problem, as soon as added all of the newer images from the production site /files folder and added them into this test site. I could then edit and save a page and the error went away. What scary looking error, when it could just say - image missing. Mar 13, 2016 at 15:54

1 Answer 1


I should have posted the answer here instead, it may help someone. This is fixed. I had missing images in the /sites/default/files/ folder. This was a upgraded d6 to d7 site with 4000 nodes and many images. I did not have the latest images in my files folder. So saving a node with uploaded cck field images threw this error.

  • Hi, thank you for reporting the fix. I think that the error message is still revealing this issue: drupal.org/node/2679491 The fields backend should never attempt to insert an empty string for a missing value instead of NULL into a numeric column, Now I know that our issue is reproducible even under MySQL.
    – Michael
    Mar 13, 2016 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.