0

So I am looking all over and have yet to find out how to remedy this table issue.

Rules is the likely culprit because the violation occurs when creating a new node (with Workflow) and trying to have it move forward to a state called publish. It fails with PDO Integrity Constraint Violation 1062.

Now the problem is that NO new nodes can be created without error, by any user. How can I fix this? The error message references a node ID that doesn't exist in any table rows, I guess because the node was never actually saved.

I have adjusted Rules so this doesn't happen again on new nodes, but I need to get that error off without losing data.

The error message is the following one:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry "694-7-workflow_access" for key "PRIMARY": INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES ....

This is weird because I have completely truncated the table, deleted and added it back, and tried to build a new copy of the DB all without success. I can't for the life of me find the primary key duplicate in ANY table. These nodes, node revisions, or node access records simply don't exist for nid 694 (or anything above 660 really).

So far I have traced it to Workflow's use of hook_node_access_records(). If I comment out module_invoke('node_' . $op, $node) the nodes will submit, so it is definitely the access table/process causing the problem. Workflow returns a $grants array just fine.

5

1 Answer 1

0

For posterity, I did not figure out the line of code that were causing this but the issue is that node_save was being called twice on a new node, which DID create a legitimate duplicate key, but then it would also delete the offending row. This drives the developer bonkers.

It has something to do with Workflow (probably), and I am not particularly proud of this but you can remedy by making one small change to node.module:

/* ADDED SPR */
$delete = true; //$op == 'update';
/* END ADDED SPR */

Top and bottom lines are for easy searching of code tweaks for upgrades.

Not the answer you're looking for? Browse other questions tagged or ask your own question.