Integrity constraint violation: 1062 Duplicate entry '19265-537-og_access:node-en' for key

Created on 21 January 2025, about 2 months ago

Problem/Motivation

The following SQL error occurs due to a duplicate entry in the node_access table:

[error] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '19265-537-og_access:node-en' for key 'node_access.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);

This issue is triggered when duplicate entries are being inserted into the node_access table, likely due to conflicting group access logic in the og_access module.

Steps to reproduce

  1. Create or update a node with Organic Groups (OG) access permissions.
  2. Ensure the node is associated with multiple groups with overlapping permissions.
  3. Attempt to save the node and observe the error in the logs or the output.

Proposed resolution

  • Identify why duplicate entries are being generated during the insert operation.
  • Introduce a validation or deduplication step before executing the INSERT operation for node_access entries.
  • Ensure that the OG access logic accounts for overlapping groups without causing duplicate primary keys.

Remaining tasks

TBD

User interface changes

No expected user interface changes.

API changes

No API changes anticipated.

Data model changes

No data model changes expected; this issue involves resolving the handling of duplicate entries in the node_access table.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada joelpittet Vancouver

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024