I was using an old -dev revision (7a47f87).

Pulled the latest -dev.

Executed drush updatedb correctly.

Trying to edit the field config and saving it gives the following error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'field_ref_a02_target_type' doesn't exist in table: CREATE TABLE {field_data_field_ref_a02} ( `entity_type` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The entity type this data is attached to', `bundle` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance', `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted', `entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to', `revision_id` INT unsigned NULL DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned', `language` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The language for this data item.', `delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields', `field_ref_a02_target_id` INT unsigned NULL DEFAULT NULL COMMENT 'The id of the target entity', PRIMARY KEY (`entity_type`, `entity_id`, `deleted`, `delta`, `language`), INDEX `entity_type` (`entity_type`), INDEX `bundle` (`bundle`), INDEX `deleted` (`deleted`), INDEX `entity_id` (`entity_id`), INDEX `revision_id` (`revision_id`), INDEX `language` (`language`), INDEX `field_ref_a02_target_entity` (`field_ref_a02_target_type`, `field_ref_a02_target_id`), INDEX `field_ref_a02_target_id` (`field_ref_a02_target_id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Data storage for field 9 (field_ref_a02)'; Array ( ) in db_create_table() (line 2644 of /.../7.x/includes/database/database.inc).

Trying to access the field config page again gives this other error:

messagePDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'd7_entityref.field_data_field_ref_a02' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {field_data_field_ref_a02} field_data_field_ref_a020 WHERE (field_data_field_ref_a020.deleted = :db_condition_placeholder_0) LIMIT 1 OFFSET 0) subquery; Array ( [:db_condition_placeholder_0] => 0 ) in field_sql_storage_field_storage_query() (line 568 of /.../7.x/modules/field/modules/field_sql_storage/field_sql_storage.module).
CommentFileSizeAuthor
#8 1438922-er-tt.patch1019 bytesPedro Lozano
#2 1438922-er-tt.patch1.23 KBPedro Lozano

Comments

Pedro Lozano’s picture

Found that this bug is caused by the changes introduced for #1319040: Remove "target_type" column from db.

Upgrades to any version after the first commit for that issue produces this crash.

Pedro Lozano’s picture

StatusFileSize
new1.23 KB

This patch contains an additional upgrade function to fix these crashes.

Pedro Lozano’s picture

Status: Active » Needs review
Matthew Davidson’s picture

Status: Needs review » Reviewed & tested by the community

+1. Works fine for me. Applied the patch, ran the upgrade, re-exported my entityreference-dependent Features without a hitch. Seems to do no harm, and excluding it would be a problem for those of us who've used it when/if there's another entityreference_update_7002().

christianchristensen’s picture

+1 This worked for me as well - applied on a working install, updatedb, and re-export -> installed clean! RTBC

kenianbei’s picture

+1 Works for me as well.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 1438922-er-tt.patch, failed testing.

Pedro Lozano’s picture

Status: Needs work » Needs review
StatusFileSize
new1019 bytes

Rerolling.

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 5 year old patch in #8 to entityreference.install does not apply to the latest 7.x-1.x-dev and if still relevant needs a reroll.

Checking patch entityreference.install...
error: while searching for:
      'not null' => TRUE,
    ));
  }
}
error: patch failed: entityreference.install:161
error: entityreference.install: patch does not apply