As the title says. If someone edits a node title and the redirect tries to change, everything goes boom.
Giving that role "Create and edit path aliases" makes the error go away.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'mSSVKeKuvgeJPJoIn0ubyQk7ao918-ubfeTbCSJxN2I' for key 2: INSERT INTO {redirect} (hash, type, uid, source, source_options, redirect, redirect_options, language, status_code, count, access) 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); Array ( [:db_insert_placeholder_0] => mSSVKeKuvgeJPJoIn0ubyQk7ao918-ubfeTbCSJxN2I [:db_insert_placeholder_1] => redirect [:db_insert_placeholder_2] => 8 [:db_insert_placeholder_3] => stories/20110404/miss-r-rules [:db_insert_placeholder_4] => a:0:{} [:db_insert_placeholder_5] => node/56893 [:db_insert_placeholder_6] => a:0:{} [:db_insert_placeholder_7] => und [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 ) in drupal_write_record() (line 6776 of /includes/common.inc).
Comments
Comment #1
dave reidIs Workbench Moderation enabled?
Comment #2
agentrickardNope.
We have an internal ticket for this. (3934)
Comment #3
dave reidWhat was the entire change history of the node?
Comment #4
agentrickardTitle changes:
- Miss R Rules
- Miss RR Rules
- Miss R Rules
- Miss R R Rules
Ad infinitum.
Comment #5
mfer commentedI can replicate this problem with the admin user.
Based on the error and some testing there is a duplicate key because of past redirects. For example, a node had a path of "boom". Now, you try to change it to "stick". Redirect would setup a redirect from boom to stick. But, stick was a previous redirect. The hashes (db row key) created are the same as a previous one and thus we get a duplicate key error.
Comment #6
dave reidThe auto-redirection does not currently check against any existing redirects and it probably should. Also, this could create problems since renaming the title back to 'Miss R Rules' the second time will cause problems as well as we will have both a redirect and an alias wanting to use the path 'miss-r-rules'. Only one shall win (and it'll be redirect.module, which may end up causing an infinite loop).
Comment #7
mfer commentedAttached is a patch that checks for the existence of the redirect before saving it. This should stop the duplicate errors.
Comment #8
dave reidI don't really see the need for the new function - just doing the following is fine as it doesn't mess up redirect_save() at all.
I'd prefer to keep this workaround simple for now since we may have to revisit it.
Powered by Dreditor.
Comment #9
dave reidComment #10
mfer commentedAnd another pass....
The big difference here is that the hash is generated w/o a lot of the same contextual information passed into the hash hooks that's available during the hash generation in the save step.
Comment #11
mfer commentedLets try this again w/o the misspelling.
Comment #12
dave reidThe additional stuff in redirect_save() is irrelevant to hashing, just to the presave/insert/update hooks, so that's why I prefer the 'simpler' version.
Comment #13
dave reidCommitted #11 with an additional quick test to Git: http://drupalcode.org/project/redirect.git/commit/5de9fd4. I'll work later on expanding the test, but for now it does its job of ensuring this fatal error doesn't pop up.
Comment #15
lsolesen commentedI started getting this error a lot after enabling workbench moderation. But only on some nodes.