SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'gid' cannot be null: INSERT INTO "node_access"

Created on 11 March 2024, 10 months ago

Problem/Motivation

When updating the module to the latest version available, and launching the drush updb command, for some strange reason I am having this error.

After some digging, I realized that the unpublished_node_permissions_node_access_records function is calling Node's getOwnerId() function to obtain the user ID of the specific node, but there may be cases where it can come as NULL, such as you can see in the images.

Proposed resolution

As a solution, I propose to use NULL coalesce, so that in the event that a NULL value (unsupported value) comes, assign a default value.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇪🇸Spain cmarrufo

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

Comments & Activities

Production build 0.71.5 2024