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.

CommentFileSizeAuthor
drupal.aggregator_module_block_save.patch800 bytesBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pp’s picture

This patch is work and resolve the problem. ( Will Berdir make the test case for this bug? #276493: Tests needed: aggregator.module)

pp

pp’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Makes 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

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.