Hi,

Open watcher.db.inc, go to line 197.

The code is:

$sql = "INSERT INTO {watcher_nodes} (uid, nid, added) VALUES(%d, %d, %d)";
$res = db_query($sql, $user->uid, $nid, time());

This causes a big error in pgsql, i don't know about mysql. The mail column in the table has primary key constraint which means that it cannot have null values, and the very same thing prouces error in pgsql, hence the row doesn't get inserted.

The possible fix for this is:

$sql = "INSERT INTO {watcher_nodes} (uid, nid, mail, added) VALUES(%d, %d, '%s', %d)";
$res = db_query($sql, $user->uid, $nid, $user->mail, time());

Comments

nileshgr’s picture

Well, before changing this, I want to ask the developer a question that - does the module find mail ids if a registered user is subscribed ?
In that case, we will have to change the database structure.

d.novikov’s picture

Status: Active » Needs review

'mail' field in watcher.install is specified as a part of a primary key. MySQL prohibits setting a column of a primary key to NULL. See for example http://dev.mysql.com/doc/refman/5.1/en/create-table.html:

A PRIMARY KEY is a unique index where all key columns must be defined as NOT NULL. If they are not explicitly declared as NOT NULL, MySQL declares them so implicitly (and silently).

As there is 'mail' field specified with NULL default value, we should change the DB structure. I suggest to use the default value '' instead of NULL. Changes are commited to the dev branch.

Any feedback will be greatly appreciated!