Here's my use-case: I upgraded a D6 site to D7, and in the D6 version my fields used a view to allow a set of nodes to reference. In the Drupal 7 version of the site, that feature was removed and we are now using content types instead. All the D7 fields were updated to indicate which content type was allowed, but since there were no views with a Reference display type, all my fields are showing an ugly warning:

Important D6 migration note:

Addtionally, they don't work correctly. When a new piece of content is created where the node reference fields are left blank, I get an ugly PDO error:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_whatever_nid' at row 1: INSERT INTO {field_data_field_whatever} (entity_type, entity_id, revision_id, bundle, delta, language, field_whatever_nid) 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] => 442 [:db_insert_placeholder_2] => 442 [:db_insert_placeholder_3] => whatever [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 448 of .../modules/field/modules/field_sql_storage/field_sql_storage.module).

The work around is to create an (unneeded) display of type References (for any view) and this will change the user interface on the field settings.

Now return to the field settings, and in the drop-down menu for which view to use, select <none>.

This will remove the view that was previously being used for the field.

Once the view has been removed, fields will begin saving without PDO errors when left empty.


jenlampton’s picture

Issue summary: View changes

clean up

jenlampton’s picture

Just ran into this again. Thanks for the tip Jen! =P

jenlampton’s picture

Issue summary: View changes