After enabling and setting up Domain module I get following error when creating new content:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '27-0-domain_site' 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] => 27 [:db_insert_placeholder_1] => domain_site [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 27 [:db_insert_placeholder_7] => domain_id [:db_insert_placeholder_8] => 1 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 1 [:db_insert_placeholder_11] => 1 ) in node_access_write_grants() (line 3425 of E:\xampp\htdocs\test\modules\node\node.module).

This error occurs only when creating new content, on all domains including default, also when logged in as user1. When viewing existing content, or editing and saving existing node everything works fine.

Database: MySQL 5.5.16
PHP: 5.3.14
Enabled DA modules: domain, domain_conf, domain_content, domain_nav

Thanks in advance for any advices.

Comments

sketman’s picture

Title: Error on node creation » Error on node creation caused by Rules rule

So after some investigation I found that the error is caused by Rules rule.
I have a simple rule with only one task: to set field value on node creation.
When I disable this rule, all works fine, no errors anymore.

Details of rule:
EVENT: After saving new content
Conditions: Content is of type
Actions: Set a data value

What is a workaround please? Is there something that need to be taken into consideration when working with Rules and DA module enabled? Need I use some conditions in Rules to chceck the domains or something else?
Changing the title to: Error on node creation caused by Rules rule

sketman’s picture

I found a workaround by simply changing the event when rule is called from "After saving new content" to "Before saving content".
After this change all works perfectly, no errors.

Can this be considered as a bug?

agentrickard’s picture

Project: Domain » Rules
Version: 7.x-3.x-dev » 7.x-2.x-dev
Component: Miscellaneous » Rules Core

In Rules, yes.

checker’s picture

I get the same error. Using as action "node_unpublish" event "node_update" or "node_insert" (tested both). After changing to "Before saving content" it works how #2 described.

checker’s picture

Category: support » bug
tr’s picture

Status: Active » Closed (cannot reproduce)