When sourceMigration specified for field mapping and there's no data in source migration,
handleSourceMigration return empty array instead of NULL

so field storage tries to insert '' in field, when field in the table isn't varchar/text
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column *
in field_sql_storage_field_storage_write() (line 448 of modules/field/modules/field_sql_storage/field_sql_storage.module).

In this case, nothing should be recorded in this field
If you want to set some value in case of empty, you just can use defaultValue method

Patch attached

Waiting for your feedback.

CommentFileSizeAuthor
migrate-source-migration-empty-value.patch386 byteschingis

Comments

chingis’s picture

Status: Active » Needs review
mikeryan’s picture

Version: 7.x-2.4 » 7.x-2.x-dev
Status: Needs review » Fixed

Committed (with a similar fix applied elsewhere), thanks.

Status: Fixed » Closed (fixed)

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

tmetzger’s picture

YES! That tiny patch fixed my issue. Thanks very much!

Tom

summit’s picture

Issue summary: View changes

Hi,
I do not know if I need to open this again...but I got these errors also with latest 7.2.dev..

General error: 1366 Incorrect integer value: 'field_bijzonderheden' for column 'delta' at row 1: INSERT INTO {field_data_field_bijzonderheden} (entity_type, entity_id, revision_id, bundle, delta, language, field_bijzonderheden_tid) 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); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => over_introductie [:db_insert_placeholder_4] => field_bijzonderheden [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) (/modules/field/modules/field_sql_storage/field_sql_storage.module:494)

greetings, Martijn