@fugazi reported this problem over in #1863638-3: after upgrade to D7 image is not altered in file_managed. . I'm separating it out for separate tracking.

When running an upgrade, it seems that somehow multiple entries are being generated in the node_gallery_relationship_type table. Node Gallery should be moving over a record for each node gallery relationship that existed in the D6 site, but for some reason it attempts to insert the same relationship multiple times into the table.

The full text of the error is:

WD node_gallery_relationship_type: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key             [error]

'PRIMARY': INSERT INTO {node_gallery_relationship_type} (id, label, filefield_name, settings) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array
(
    [:db_insert_placeholder_0] => 1
    [:db_insert_placeholder_1] => Node Gallery Default
    [:db_insert_placeholder_2] => field_node_gallery_image
    [:db_insert_placeholder_3] => a:6:{s:12:"relationship";a:1:{s:4:"name";s:20:"Node Gallery
Default";}s:9:"item_view";a:3:{s:17:"display_navigator";i:1;s:27:"view_navigator_item_display";s:39:"node_gallery_gallery_item_views:embed_5";s:13:"pa
ge_fragment";i:0;}s:12:"manage_items";a:6:{s:12:"items_fields";a:20:{s:5:"title";s:5:"title";s:10:"body_field";i:0;s:20:"revision_information";i:0;s:6
:"author";i:0;s:7:"options";i:0;s:16:"comment_settings";i:0;s:4:"path";i:0;s:17:"detailed_question";i:0;s:13:"sexybookmarks";i:0;s:3:"url";i:0;s:11:"c
lick_count";i:0;s:10:"last_click";i:0;s:11:"last_status";i:0;s:16:"last_status_info";i:0;s:12:"last_checked";i:0;s:7:"urlhash";i:0;s:10:"reciprocal";i
:0;s:15:"image_navigator";i:0;s:23:"nopremium_message_field";i:0;s:24:"field_node_gallery_image";i:0;}s:14:"items_per_page";i:20;s:15:"enable_rotation
";b:1;s:15:"rotation_radios";b:1;s:14:"rotation_modal";b:1;s:11:"item_fields";a:1:{s:18:"node_gallery_ref_1";s:18:"node_gallery_ref_1";}}s:2:"og";a:1:
{s:10:"sync_items";b:1;}s:17:"relationship_type";a:2:{s:13:"gallery_types";a:1:{i:0;s:20:"node_gallery_gallery";}s:10:"item_types";a:1:{i:0;s:18:"node
_gallery_image";}}s:10:"view_modes";a:2:{s:4:"full";a:1:{s:4:"view";s:39:"node_gallery_gallery_item_views:embed_1";}s:6:"teaser";a:1:{s:4:"view";s:39:
"node_gallery_gallery_item_views:embed_6";}}}
)
 in drupal_write_record() (line 7106 of K:\xampp\htdocs\fbk1212\includes\common.inc).
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY'                                                    [error]

Performed update: node_gallery_update_7002                                                                                                        [ok]
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Status: Active » Needs review
FileSize
1.1 KB

Here's a patch that works around the problem. I've spent hours trying to figure out how these duplicate entries are being created but I can't figure it out. Instead of preventing the multiple calls, this adds a sanity check to ensure that the current relationship being inserted doesn't exist already.

zengenuity’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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