Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The feed aggregator seems to mess up the (mySQL) database, when multiple catagories have been assigned to a rss feed.
When you run cron, following error will be displayed.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-281' for key 1: UPDATE {aggregator_category_item} SET cid=:db_update_placeholder_0 WHERE ( (iid = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => 1 [:db_condition_placeholder_0] => 281 ) in aggregator_save_item() (line 170 of /***/aggregator/aggregator.processor.inc).
Comment | File | Size | Author |
---|---|---|---|
#4 | aggregator_fix_wrong_merge_query.patch | 789 bytes | Berdir |
Comments
Comment #1
Rodgey CreditAttribution: Rodgey commentedreproducing the bug:
1 - create more than 1 catagory in the feed aggregator.
2 - add a feed item (you might use f.e. "http://online.wsj.com/xml/rss/3_7085.xml")
!important: check more than one catagory.
3 - run update for this feed
bug 1:
You will now find out that the items are just catagorized for one catagory instead of the multiple catagories that you've put with a checkbox while adding the feed.
4 - click on the feed name in the feed overview
5 - choose catagorize
6 - add the checkboxes (again) for multiple catagories
Bug 2
Now the rss feed will be shown in multiple catagories, but cron won't run anymore and produce the following error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-281' for key 1: UPDATE {aggregator_category_item} SET cid=:db_update_placeholder_0 WHERE ( (iid = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => 1 [:db_condition_placeholder_0] => 281 ) in aggregator_save_item() (line 170 of /***/aggregator/aggregator.processor.inc).
I've been experimenting a little and found that the index data from aggregator_feed_item in the db are blocking cron to run.
Comment #2
montesq CreditAttribution: montesq commentedsubscribe
Comment #3
BerdirThis is a problem with how aggregator.module is using the database system, not in the database system itself.
Comment #4
BerdirSee changed title.
The function used db_merge() incorrectly but it did work anyway in the past because MergeQuery was implemented in the same wrong way :)
Later, MergeQuery was fixed but aggregator_save_item() wasn't, because there are no tests for this. This is now covered by the updated tests in #276493: Tests needed: aggregator.module
Comment #5
BerdirComment #6
BerdirMoving to the 8.x queue and tagging for possible backport.
Comment #7
Berdir#4: aggregator_fix_wrong_merge_query.patch queued for re-testing.
Comment #8
njardim CreditAttribution: njardim commentedhi Berdir: I have a similar problem in updating aggregator's categories in D7 which is:
I have more then 200 Feeds splited into arround 40 Categories. There are 20 main categories to which each of the Feeds belong to and then they are also splited into minor categories. All Feeds are being updated but some of the Categories are not being updated at all. They are still resting at 0 items.
I've tried with Linux and Windows versions of Drupal 7 with the same results.
Do you have a fix for this problem?
Thank you very much.
njardim
Comment #9
BerdirHave you tried this patch? That's exactly that bug that should be fixed by this.
Note that you will have to re-import your feeds, the categorization is missing from the database and needs to be re-added.
Comment #10
njardim CreditAttribution: njardim commentedhi Berdir: at the first cron run aggregator_fix_wrong_merge_query.patch fixed the problem.
Thank you very much.
njardim
Comment #11
Damien Tournoud CreditAttribution: Damien Tournoud commentedLooks like a no-brainer, but it also means we have no test for this :(
Comment #12
BerdirSee #4, there are tests for this in a separate issue (which currently fail because this patch is missing).
Comment #13
bfroehle CreditAttribution: bfroehle commentedGiven:
I'd suggest going ahead and committing this simple fix to 8.x-dev and 7.x-dev.
Comment #14
Dries CreditAttribution: Dries commentedI committed this to 7.x and 8.x. Tests are in #276493: Tests needed: aggregator.module.
Comment #15
aspilicious CreditAttribution: aspilicious commenteduntagging
Comment #16
debo7debo CreditAttribution: debo7debo commentedcan someone explain how do i fix this problem in simple basic instructions? I do not know what you all mean by "cron" and such. My categories won't fill up, it stuck at 0 in D7.
Comment #17
debo7debo CreditAttribution: debo7debo commentedcan you give me instructions how to fix this? I don't know what "cron" means.
Comment #18
catchGo to admin/reports/status - somewhere in there is a report about cron.
This will only be fixed in the latest 7.x-dev - you need to download and use that (or wait for 7.1) to get the fix.
Please don't re-open fixed issues with support requests.
Comment #19
catchRe-setting title.