Integrity constraint violation: 1062 Duplicate entry after upgrade module

Created on 1 June 2023, over 1 year ago
Updated 3 August 2023, over 1 year ago

Problem/Motivation

I've upgraded module from 8.x-1.0-alpha4 to 2.0.0-rc1 and when I've tried to rebuild permissions I got the error:

Integrity constraint violation: 1062 Duplicate entry '3484-3-content_access_roles-en' for key 'PRIMARY': INSERT INTO "node_access" ("nid", "langcode", "fallback", "realm", "gid", "grant_view", "grant_update", "grant_delete") 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), (:db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15), (:db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19, :db_insert_placeholder_20, :db_insert_placeholder_21, :db_insert_placeholder_22, :db_insert_placeholder_23), (:db_insert_placeholder_24, :db_insert_placeholder_25, :db_insert_placeholder_26, :db_insert_placeholder_27, :db_insert_placeholder_28, :db_insert_placeholder_29, :db_insert_placeholder_30, :db_insert_placeholder_31), (:db_insert_placeholder_32, :db_insert_placeholder_33, :db_insert_placeholder_34, :db_insert_placeholder_35, :db_insert_placeholder_36, :db_insert_placeholder_37, :db_insert_placeholder_38, :db_insert_placeholder_39), (:db_insert_placeholder_40, :db_insert_placeholder_41, :db_insert_placeholder_42, :db_insert_placeholder_43, :db_insert_placeholder_44, :db_insert_placeholder_45, :db_insert_placeholder_46, :db_insert_placeholder_47); Array
(
[:db_insert_placeholder_0] => 3484
[:db_insert_placeholder_1] => en
[:db_insert_placeholder_2] => 1
[:db_insert_placeholder_3] => content_access_roles
[:db_insert_placeholder_4] => 3
[:db_insert_placeholder_5] => 1
[:db_insert_placeholder_6] => 0
[:db_insert_placeholder_7] => 0
[:db_insert_placeholder_8] => 3484
[:db_insert_placeholder_9] => en
[:db_insert_placeholder_10] => 1
[:db_insert_placeholder_11] => content_access_roles
[:db_insert_placeholder_12] => 5
[:db_insert_placeholder_13] => 1
[:db_insert_placeholder_14] => 0
[:db_insert_placeholder_15] => 0
[:db_insert_placeholder_16] => 3484
[:db_insert_placeholder_17] => en
[:db_insert_placeholder_18] => 1
[:db_insert_placeholder_19] => content_access_roles
[:db_insert_placeholder_20] => 6
[:db_insert_placeholder_21] => 1
[:db_insert_placeholder_22] => 0
[:db_insert_placeholder_23] => 0
[:db_insert_placeholder_24] => 3484
[:db_insert_placeholder_25] => en
[:db_insert_placeholder_26] => 1
[:db_insert_placeholder_27] => content_access_roles
[:db_insert_placeholder_28] => 3
[:db_insert_placeholder_29] => 1
[:db_insert_placeholder_30] => 0
[:db_insert_placeholder_31] => 0
[:db_insert_placeholder_32] => 3484
[:db_insert_placeholder_33] => en
[:db_insert_placeholder_34] => 1
[:db_insert_placeholder_35] => content_access_roles
[:db_insert_placeholder_36] => 5
[:db_insert_placeholder_37] => 1
[:db_insert_placeholder_38] => 0
[:db_insert_placeholder_39] => 0
[:db_insert_placeholder_40] => 3484
[:db_insert_placeholder_41] => ru
[:db_insert_placeholder_42] => 1
[:db_insert_placeholder_43] => content_access_roles
[:db_insert_placeholder_44] => 6
[:db_insert_placeholder_45] => 1
[:db_insert_placeholder_46] => 0
[:db_insert_placeholder_47] => 0

Steps to reproduce

1) Upgrade module from 8.x-1.0-alpha4 to 2.0.0-rc1.
2) Try to rebuild content permissions.
3) Get the error specified above.

After upgrade, when I'm trying to rebuild content permissions, site trying to add duplicate entry into the 'node_access' table with gid=3 not for all nodes but for the some nodes (and I don't understand, what nodes will be affected).

After downgrade to 8.x-1.0-alpha4 version, rebuild content permissions completed successfully.

However, this does not always happen when rebuilding permissions after upgrading. More details about how to reproduce is needed.

Proposed resolution

No resolution known yet.

Remaining tasks

Pending.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇺Russia msidiagnos

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024