Sometimes I get a generic error while using the merge operation.
Looking at drupal logs I find similar entries:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '18x1RlxnhGpuW_y2HSUeEXWMA0QV9yEpgskCIG-iLhM' for key 'hash': 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] => 18x1RlxnhGpuW_y2HSUeEXWMA0QV9yEpgskCIG-iLhM [:db_insert_placeholder_1] => redirect [:db_insert_placeholder_2] => 6874 [:db_insert_placeholder_3] => taxonomy/term/23016 [:db_insert_placeholder_4] => a:0:{} [:db_insert_placeholder_5] => concorsi-amministativo [: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() (linea 7136 di ..../includes/common.inc).
So it seems that redirect_save is trying to save a redirect for an already existing combination.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | term_merge-avoid-duplicate-redirects-2005212-1.patch | 667 bytes | bago |
Comments
Comment #1
bago commentedA very basic patch checking for existing redirects before saving it.
Comment #2
bucefal91 commentedThank you, bago! That's a good observation and just right fix on it.
You filed it against 2.x... which is kinda deprecated, just to have it properly documented, I'll switch to 7.x-1.x if you do not mind.
I have committed the patch.