I have a rule set up that does a bunch of parsing when a content type with a user EntityReference field is saved (Using the "After Save" Rules event). It works fine -- until I enabled Content Access to restrict access to that content type. Now, whenever I create a new piece of content with that type, I get the following error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '163-3-content_access_rid' for key 'PRIMARY': INSERT INTO {node_access} (nid, 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); Array ( [:db_insert_placeholder_0] => 163 [:db_insert_placeholder_1] => content_access_rid [:db_insert_placeholder_2] => 3 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 ) in node_access_write_grants() (line 3392 of /home/a_site/public_html/modules/node/node.module).
This does not occur if change the event to "Before Save"; alas, I need a NID for my rule to work properly.
I'm not sure whether this is more of a Content Access or EntityReference bug; any thoughts?
Thanks! (BTW: Great work on this module, I've used it on a few different sites and really like it.)
See also: http://drupal.org/node/1097248
Comments
Comment #1
bennos commentedcould be related to http://drupal.org/node/1740312
have a look at the patch.
Comment #2
bennos commentedRun in to the same error.
It is not an entity reference problem. The rule produces the error. just change it from "after saving...." to "before saving...." and the error goes away.
Comment #3
aendra commentedLooking at #1740312: Duplicate entries: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry, it seems that problem is occurring when drupal_write_record() is being called; my issue is when node_access_write_grants() is being called. While they may be related, I'd like to leave this issue open until it can indeed be confirmed it's a duplicate of that. Resetting status to "Active" as such.