Error message on admin page immediately after installation

sadotter - June 5, 2009 - 23:25
Project:Watcher
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi there, I just installed 6.x-1.2, and I navigated to admin/settings/watcher. I received this warning message:

user warning: Field 'automatic_enable_notifications' doesn't have a default value query: INSERT INTO watcher_user_settings (uid) SELECT u.uid FROM users u LEFT JOIN watcher_user_settings wus ON u.uid = wus.uid WHERE ISNULL(custom) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mysite\sites\all\modules\watcher\watcher.db.inc on line 363.

I checked "Blog entry" as a content type that can be watched, hit "Save", and I continue to receive this error message. Any thoughts?

#1

sadotter - June 10, 2009 - 16:19

Ok, I think I figured out what the problem is. I already had ten users on my system, and the problem was that the module wouldn't save the "Default User Settings" for these users in the watcher_user_settings table.

When you go to the admin settings page and click "save configuration", several database update functions get called, including _watcher_db_user_settings_update_defaults.

_watcher_db_user_settings_update_defaults first looks for existing users who don't have a record in the watcher_user_settings table. For each of these users, it tries to insert a row into watcher_user_settings. The problem is that it first tries to do a bulk insert for each of these user ids, by just declaring a value for uid, but not declaring values for the other database columns. The database table is not set up to provide default values for these columns, so it aborts.

My fix was to manually edit the table watcher_user_settings table and provide a default value of "0" for each of the seven table columns. There's probably an easy code fix, involving changes to the function watcher_schema in the file watcher.install. Then it's just a matter of providing default values for each of the columns in watcher_user_settings.

#2

solipsist - June 14, 2009 - 10:56

Thanks for reporting. I'll fix this in the next release.

#3

solipsist - July 10, 2009 - 14:45
Status:active» closed

Fix applied. To be committed.

 
 

Drupal is a registered trademark of Dries Buytaert.