D7.22, PHP 5.4, Rules 7.2.3
When enabling CA module I can't save node due:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '474-0-all' 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] => 474 [:db_insert_placeholder_1] => all [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 ) w node_access_write_grants() (line 3551 from /home/mysite/modules/node/node.module).

Patch from this issue didn't help.

Disabling CA module allows me to add new content without problem.

Comments

anybody’s picture

Same problem here within ERPAL install profile, while creating an erpal-date node:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '159-0-all' 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] => 159 [:db_insert_placeholder_1] => all [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 ) in node_access_write_grants() (line 3551 of ......./erpal/modules/node/node.module).

Rules not installed!

heatherwoz’s picture

Same error, doesn't affect most nodes except for certain types that have rules called after creation. The rules trigger on Before saving content and After saving new content.

ivansf’s picture

I ran into the same error, I also had to disable custom rules for that content type in order to fix it.

matthewgann’s picture

Same error.

It comes after save when I run a rule to change a field's data.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '467-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), (:db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => 467 [: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 [:db_insert_placeholder_6] => 467 [:db_insert_placeholder_7] => content_access_author [:db_insert_placeholder_8] => 12 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 0 ) in node_access_write_grants()
matthewgann’s picture

cgdrupalkwk’s picture

#5 worked for me! Thanks!!!!!!! I spent hours trying to figure this out.

Topcheese’s picture

#5 also worked for me to solve the issue. @Grzegorz Zbiński, what mySQL version are you using?

massiws’s picture

Same issue here:

  • Drupal 7.24
  • Content Access 7.x-1.2-beta2
  • Rules 7.x-2.6
  • PHP 5.3.27

#5 fix the problem!

Thank you.

Anurag Ashok’s picture

#5 fixes it for me too

krystlc’s picture

ditto, this is still an issue for 7.24 but #5 works thankfully~

ergophobe’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)

As the patch referenced in #5 indicates, this is a duplicate of #1146244: node_access integrity constraint violation on module_invoke_all('node_' . $op, $node);

lajpatdhingra’s picture

I am not a coder. How to use #5?

massiws’s picture

@lajpatdhingra:
- click on link in #5;
- save all in a file "patch.patch" in [your_drupal_site]/modules/node/node.module folder;
- read this guide and follow your preferred method.