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.
Install file of the aggregator module doesn't give a default value for description
and image
fields so "add feed" fails on MySQL 5.0.18. Drupal doesn't handle this situation and shows The feed %s has been added.
but this is not true. Same thing happens on Drupal 4.7.3 and 4.6.9.
I am not posting a patch because I couldn't understand why we have DEFAULT ''
for required fields like title, url and not for optional description, image fields. All of these fields are NOT NULL
.
Comment | File | Size | Author |
---|---|---|---|
#22 | i_hate_mysql_now.png | 281.11 KB | mchrisneglia |
#13 | aggregator_add_feed_mysql_strict.patch.txt | 1.04 KB | erdemkose |
#12 | aggregator.module_15.patch | 804 bytes | friedchuckles |
#1 | aggregator_install_mysql_missing_default.patch | 847 bytes | erdemkose |
Comments
Comment #1
erdemkose CreditAttribution: erdemkose commentedPostgreSQL version of the same problem has been fixed. Same things happen if MySQL5 is used. I am attaching the patch this time.
Comment #2
gregglesThis will fix new installations, but don't we need to upgrade existing installations using a hook_update?
I see that the pgsql was accepted without an update so I leave the status at PCNR, but it seems to me that it needs work.
Comment #3
ChrisKennedy CreditAttribution: ChrisKennedy commentedTEXT/BLOB fields should not have default values. See http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html
Comment #4
erdemkose CreditAttribution: erdemkose commentedYes, you are right. MySQL 5 doesn't allow default values for TEXT/BLOB fields. I don't remember why I created this issue, so I tried it again.
Now,
Drupal 5.0-beta2 creates tables successfully but some of the INSERT commands cannot be executed since no default value is defined for several columns. for example:
These queries try to create the navigation and login blocks but they fail. MySQL says:
My issue was about aggregator so I searched the aggregator module for similar dependence:
description
andimage
fields are not included in the INSERT statement so this query will fail and this means you cannot aggregate any feed on your website.I think Drupal queries must be rewritten without depending default value on TEXT/BLOB fields.
Comment #5
erdemkose CreditAttribution: erdemkose commentedI see that watchdog table doesn't exist because it has a DEFAULT value on
location
which is a TEXT field.Comment #6
Heine CreditAttribution: Heine commentedThe watchdog table has been fixed by http://drupal.org/node/98551.
Comment #7
ChrisKennedy CreditAttribution: ChrisKennedy commentedVarious errors such as this have already been reported and some have been fixed. Please keep this issue focused on aggregator.module.
Comment #8
kickn CreditAttribution: kickn commentedhas this been fixed yet?
Comment #9
ChrisKennedy CreditAttribution: ChrisKennedy commentedThere hasn't been a commit from this issue.... so probably not. Feel free to test and verify this though.
Comment #10
allen CreditAttribution: allen commentedThis is the only bug im left with fixing, Have anyone found a fix or workaround, how can i get that patch to work?
Comment #11
rssaddict CreditAttribution: rssaddict commentedAre there any plans to fix this? Or a workaround?
Or should I be using another aggregation module?
Comment #12
friedchuckles CreditAttribution: friedchuckles commentedI've updated the "INSERT INTO {aggregator_feed}" statement in aggregator.module to include an empty string value for "description" and "image". I'm not sure if this is the long term solution but it fixes the "Add Feed" mysql error.
Comment #13
erdemkose CreditAttribution: erdemkose commentedI created a patch for 6.x-dev. Otherwise this issue will not be fixed, I think. Whoever commits this patch, please backport it.
Aggregator in 6.x-dev throws notices but I am not fixing it because there is an issue about it. http://drupal.org/node/132369
Comment #14
Dries CreditAttribution: Dries commentedI'd actually prefer to update the table definition so that we have a default value. More consistent with the rest of the code.
Comment #15
erdemkose CreditAttribution: erdemkose commentedAFAIK MySQL 5 and PostgreSQL don't allow TEXT columns to have a DEFAULT value. We discussed this earlier and didn't set DEFAULT for TEXT columns.
If we will solve this issue by changing table definitions then we have to limit the length of the column and find a way to update existing tables.
Comment #16
agentrickardGiven ChrisKennedy's point in comment #3, the options for patch are:
1) Accept the patch from #13 (http://drupal.org/files/issues/aggregator_add_feed_mysql_strict.patch.txt).
2) Change the schema of {aggregator_feed}, setting both 'description' and 'image' to VARCHAR(255). Currently both are LONGTEXT, which is total overkill. From http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html
With the 'image' column, this doesn't really present a problem. For 'description' it might.
Can anyone with SQL access to Drupal.org tell me the longest value of these columns in our dataset?
3) Refresh the feed on initial acquisition and store the data the first time the feed is stored. I'm not sure why Aggregator doesn't fetch and validate feeds when they are first entered. Doing so gives us a chance to tell the admin that the feed is broken so they can correct it. Even so, the table columns need to be refactored to MEDIUMTEXT or VARCHAR.
So the simplest solution is #1, since aggregator_refresh() fills in the missing data.
Anyone have data to support options #2?
Comment #17
hass CreditAttribution: hass commentedshould really be fixed for final...
Comment #18
catchhttp://api.drupal.org/api/function/aggregator_save_feed/6
Looks like it's already been fixed. If you can reproduce with the new code, please reset.
Comment #20
chx CreditAttribution: chx commentedIf it's fixed, it's fixed.
Comment #21
Gábor HojtsyYes, this was fixed in #174348 and #148973.
Comment #22
mchrisneglia CreditAttribution: mchrisneglia commentedWhat's going on here in some cases is an inconsistency between linux and windows with mysql 5.0+
http://bugs.mysql.com/bug.php?id=13794
The problem is that -in windows- you cannot set the longtext type with '' as a default value. It will complain when you try to create or alter the table.
The fix to make the aggregator module work, however, was for me to remove the 'not null' requirement for the longtext types and not set a default. We shouldn't have to mess with the database, but well, that's the price for using open source. Freedom isn't free!
I would prefer we run drupal on linux, but I don't have that option in my workplace.