This set of errors appeared while loading a page, and the next page load did not appear. I assume it was a routine involved in sending an update e-mail, which does not run every time the page is loaded. So repeating this error wouldn't easily be done.

BTW, I'm running Drupal 5.1.

user warning: Unknown column 'id' in 'where clause' query: _banner_mail UPDATE banner SET failed_notify = notify_failed + 1 WHERE id = 0 in /includes/database.mysql.inc on line 172.
user warning: Unknown column 'id' in 'where clause' query: _banner_mail UPDATE banner SET failed_notify = notify_failed + 1 WHERE id = 0 in /includes/database.mysql.inc on line 172.
user warning: Unknown column 'id' in 'where clause' query: _banner_mail UPDATE banner SET failed_notify = notify_failed + 1 WHERE id = 0 in /includes/database.mysql.inc on line 172.
user warning: Unknown column 'id' in 'where clause' query: _banner_mail UPDATE banner SET failed_notify = notify_failed + 1 WHERE id = 0 in /includes/database.mysql.inc on line 172.
user warning: Unknown column 'id' in 'where clause' query: _banner_mail UPDATE banner SET failed_notify = notify_failed + 1 WHERE id = 0 in /includes/database.mysql.inc on line 172.
user warning: Unknown column 'id' in 'where clause' query: _banner_mail UPDATE banner SET failed_notify = notify_failed + 1 WHERE id = 0 in /includes/database.mysql.inc on line 172.

Comments

plumbley’s picture

Status: Active » Needs review
StatusFileSize
new1.72 KB

Banner is trying to the following, to stop further notifications when an email fails:

   // too many notifications failures, disabling user's notification
   db_query('UPDATE {banner} SET notify_day = 0, notify_week = 0 WHERE id = %d', $banner->id);

But the id field (presumably intended to be "uid") is not set.

Actually it's not trivial to fix this because the user id uid is held in the {node} table, while the other information is in the {banner} table. Pending a full fix, here is a patch that simply change this (and 2 similar lines in the same region) to nid (which is in the {banner} table) instead of id/uid (which isn't).

Best wishes, Mark.

plumbley’s picture

While here, a couple of related bugs:
(1) Incrementing the notification failures column (1326 in HEAD) referred to the "failed_notify" column instead of "notify_failed" column

        db_query('UPDATE {banner} SET failed_notify = notify_failed + 1 WHERE id = %d', $banner->id);

should be

       db_query('UPDATE {banner} SET notify_failed = notify_failed + 1 WHERE nid = %d', $banner->nid);

(2) Loading a banner for weekly notification (HEAD line 158) forgets to load the "notify_failed" field at all, meaning it will get reset to zero at the end of each week.

The updated patches attached fix those related bugs for 4.7 and HEAD (5.x) while we're fixing the id bug. Mark