When trying to update the number of feed items in the block configuration of a aggregator category, it fails with the following Exception:
PDOException: INSERT INTO {aggregator_category} (block, cid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1) ON DUPLICATE KEY UPDATE block=VALUES(block) - Array ( [:db_insert_placeholder_0] => 4 [:db_insert_placeholder_1] => 2 ) SQLSTATE[HY000]: General error: 1364 Field 'description' doesn't have a default value in aggregator_block_save() (line 339 of .../aggregator.module).
I think the easiest way is to replace db_merge() with db_update(), simply because we don't need db_merge() in that scenario.
- If we configure a block of a aggregator category, we can assume that the aggregator category exists.
- If the category is for some reason *not* available (it might have been deleted), db_update() will silently do nothing, which makes sense. db_merge() would either fail because not all needed fields are available (like how it's doing now) or re-create the category. I don't think that should happen.
Comment | File | Size | Author |
---|---|---|---|
drupal.aggregator_module_block_save.patch | 800 bytes | Berdir | |
Comments
Comment #1
pp CreditAttribution: pp commentedThis patch is work and resolve the problem. ( Will Berdir make the test case for this bug? #276493: Tests needed: aggregator.module)
pp
Comment #2
pp CreditAttribution: pp commentedComment #3
webchickMakes sense. I ran this by Crell too and he said that although he didn't understand enough about Aggregator module's internals to comment on the approach, the code looked sound.
Committed to HEAD. Thanks! Now let's get those Aggregator tests in so we never break it again. Hooray! :D