Doing a 6.24 (views 2.14) to 7.12 (views 3.3) upgrade using drush. I'm trying to enable the views module and I get an error. It's trying to insert the views blocks into the database. However, those blocks already exist due to this being an upgrade from a working D6 site. Views refuses to be enabled so my upgrade is a bit stuck at this point.

Views info:

dking@dking-mbp ~/Projects/test/upgraded.www.test.org $ drush pm-info views
 Project          :  views
 Type             :  module
 Title            :  Views
 Description      :  Create customized lists and queries from your database.
 Version          :  7.x-3.3
 Package          :  Views
 Core             :  7.x
 Status           :  disabled
 Path             :  sites/all/modules/contrib/views
 Schema version   :  7301
 Files            :  yada, yada, yada
 Requires         :  ctools

The error:

dking@dking-mbp ~/Projects/test/upgraded.www.test.org $ drush en views
The following extensions will be enabled: views
Do you really want to continue? (y/n): y
WD php: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'garland-views-events-block_1' for key 'tmd': INSERT INTO {block} (module, delta,   [error]
theme, status, weight, region, pages, cache) 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); Array
(
    [:db_insert_placeholder_0] => views
    [:db_insert_placeholder_1] => events-block_1
    [:db_insert_placeholder_2] => garland
    [:db_insert_placeholder_3] => 0
    [:db_insert_placeholder_4] => 0
    [:db_insert_placeholder_5] => -1
    [:db_insert_placeholder_6] => 
    [:db_insert_placeholder_7] => -1
)
 in drupal_write_record() (line 6975 of /Users/dking/Projects/test/upgraded.www.test.org/includes/common.inc).
Cannot modify header information - headers already sent by (output started at /usr/lib/php/drush/includes/drush.inc:596) bootstrap.inc:1239                                     [warning]
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'garland-views-events-block_1' for key 'tmd': INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) 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); Array
(
    [:db_insert_placeholder_0] => views
    [:db_insert_placeholder_1] => events-block_1
    [:db_insert_placeholder_2] => garland
    [:db_insert_placeholder_3] => 0
    [:db_insert_placeholder_4] => 0
    [:db_insert_placeholder_5] => -1
    [:db_insert_placeholder_6] => 
    [:db_insert_placeholder_7] => -1
)
 in drupal_write_record() (line 6975 of /Users/dking/Projects/test/upgraded.www.test.org/includes/common.inc).
Drush command terminated abnormally due to an unrecoverable error.                                                                                                              [error]

Comments

dkingofpa’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.3 » 7.12
Component: Miscellaneous » block.module
Assigned: Unassigned » dkingofpa
Status: Active » Closed (fixed)

Attached is a stacktrace from my issue. The problem ended up being in the _block_rehash() function. The delta in the block table was "Events-block_1", but _block_rehash() somehow had lowercase results coming from somewhere. As a result, it treated "Events-block_1" different than "events-block_1" so it thought there was a new block. But the database saw them as the same value, hence the duplicate entry error. I changed the delta values in the database to be all lowercase for the records that triggered the issue and views worked.

ytsurk’s picture

expected the same .. after import