If i try to add a feed in "admin/content/aggregator/add/feed" i get the following error. The feed is not added, but reported as added. This is a from new test installation.

<?php
user warning
: Field 'description' doesn't have a default value query: INSERT INTO aggregator_feed (fid, title, url, refresh, block) VALUES (1, 'Drupal.org', 'http://drupal.org/node/feed', 604800, 5) in C:\Inetpub\wwwroot\drupal5\includes\database.mysqli.inc on line 151.
?>
Files: 
CommentFileSizeAuthor
#11 description.patch2.91 KBenobrev

Comments

xeladrane’s picture

I get this same problem.
It seems to be a bug in Drupal 5.5, I don't think I had this problem with 5.3 although I may have reconfigured MySQL since then, and it is related to the MySQL implementation.

If you run MySQL in Strict mode, then since the aggregator.install file doesn't include a default for the description field (or the image field), the save function for adding a feed fails. See the following issue:

http://drupal.org/node/84078

berenErchamion’s picture

I get the same error when using:
Drupal 5.3
GD library bundled (2.0.34 compatible)
MySQL database 5.0.45
PHP 5.2.5
Unicode library Standard PHP
Web server Apache/2.2.4 (Win32) PHP/5.2.5

I'm running this on a clean install on Win32.

beren

berenErchamion’s picture

I updated to drupal 5.5 and I still get the same error:

user warning: Field 'description' doesn't have a default value query: INSERT INTO aggregator_feed (fid, title, url, refresh, block) VALUES (3, 'Tarn Aeluin', 'http://tarnaeluin.wordpress.com/feed/', 3600, 5) in C:\Apache\htdocs\drupal-5.3\includes\database.mysql.inc on line 172.

Any idea what the problem might be?

beren

berenErchamion’s picture

I modified the code to add a default value for description and then tried the function again from the admin panel. Now I get the same error, but instead of description now I get an error on the image column. I looked into the database and these columns are definitely in the database so something seems funky. I'm using the Eclipse database tools, which seem to be pretty inept and not capable of really seeing too much about the settings at the column level.

Using the MySQL prompt and a show columns command I can see that there is no default set for a bunch of columns that are not in the form on the web page:

mysql> show columns from aggregator_feed;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------ --+------+-----+---------+----------------+
| fid | int(11) | NO | PRI | NULL | auto_increment |
| title | varchar(255) | NO | UNI | | |
| url | varchar(255) | NO | UNI | | |
| refresh | int(11) | NO | | 0 | |
| checked | int(11) | NO | | 0 | |
| link | varchar(255) | NO | | | |
| description | longtext | NO | | | |
| image | longtext | NO | | | |
| etag | varchar(255) | NO | | | |
| modified | int(11) | NO | | 0 | |
| block | tinyint(4) | NO | | 0 | |
+-------------+--------------+------+-----+---------+----------------+
11 rows in set (0.25 sec)

beren

berenErchamion’s picture

Well I fixed this issue by manually going into MySQL and setting default values on the columns that did not have one. You can do this with this command:

alter table aggregator_feed alter column link set default 'NA'; commit;

You need to be logged into your Drupal database with the right pivs...

Once I did this then I could add feeds and see them getting retrieved and stuff.

beren erchamion
http://tarnaeluin.wordpress.com/

nsk’s picture

Status:Active» Postponed (maintainer needs more info)

I think this is fixed in 6. I can't reproduce it with 5.5 (mysql), and I tried feeds without description. Can someone include more info, not only about your mysql version, but specifically about its config (you run under strict mode maybe?).

hass’s picture

Status:Postponed (maintainer needs more info)» Active

I have mysql 5 in strict mode

berenErchamion’s picture

I'm using a completely default install of MySQL on Win32. Here's my sql-mode:

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

All my version info is above.

beren

Andrey Zakharov’s picture

Priority:Critical» Minor

ALTER TABLE `aggregator_feed` CHANGE `description` `description` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci

NULL

Andrey Zakharov’s picture

ALTER TABLE `aggregator_feed` CHANGE `image` `image` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci

NULL

its heal

enobrev’s picture

StatusFileSize
new2.91 KB

The problem is when mysql is set to strict mode. It seems you cannot set a default value on a text / blob. AND, since there is no default value, and the query isn't setting a value, mysql chokes up. To fix this issue, you need to add the description and image fields to the update and insert queries in the aggregator_save_feed function in modules/aggregator/aggregator.module

Mark

update: posting patch.

computerwill’s picture

Status:Active» Needs review

Thanks for the patch! Evidently, this issue still exists in 5.7 stable, except it has moved down to line 172. I'm also running on Windows XP, PHP 5.2.5, MySQL 5.0.45 in strict mode. I just applied the patch you posted, and it appears to have fixed the problem on my localhost environment. The latest version in CVS fixed it a different way, though.

Field &#039;description&#039; doesn&#039;t have a default value query: INSERT INTO drupcjb_aggregator_feed (fid, title, url, refresh, block) VALUES (1, &#039;Tennessee real-estate economy articles&#039;, &#039;http://news.google.com/news?num=100&amp;hl=en&amp;q=tennessee+real-estate+economy&amp;ie=UTF-8&amp;output=atom&#039;, 10800, 5) in C:\localweb\apache2.2\htdocs\jcb\includes\database.mysql.inc on line 172.

Does the 6.x fix get backported to the 5.x series, or should we just backport this patch? It looks very similar to the fix that's used in the CVS.

drupalb’s picture

Version:5.5» 5.7

Thanks a great deal for the patch enobrev.

drumm’s picture

computerwill, it would be best to send this to Drupal 6.x or 7.x first.

sammorgan’s picture

How the devil do you apply this patch, from a Drupal genuis/sql novice;)

earnie’s picture

cd
patch < description.patch

sammorgan’s picture

Thanks ernie. I dont seem to be able to run this command in ms dos or cygwin, command not found! I dont suppose anyone has this patched file?

Thanks in advance

Sam

ztyx’s picture

Patch command line interface for Windows: http://gnuwin32.sourceforge.net/packages/patch.htm

earnie’s picture

For cygwin you may need to run the setup program and install it. Ask on their lists for help.

sammorgan’s picture

Having on luck at all with this... Does anybody have the actual patched file? Thanks in advance

Sam

drumm’s picture

Status:Needs review» Needs work

I do not think the UPDATE query need to be changed. Drupal 6 does not have description = ''. It might remove descriptions which are wanted.

dpearcefl’s picture

Status:Needs work» Closed (won't fix)

Considering the time elapsed between now and the last comment plus the fact that D5 is no longer supported, I am closing this ticket.