Page MenuHomePhabricator

Watchlist notification broken in MySQL
Closed, ResolvedPublic

Description

Author: mediawiki

Description:
Kate merged ORACLE_WORK for WatchedItem.php and it broke MYSQL.

http://cvs.sourceforge.net/viewcvs.py/wikipedia/phase3/includes/WatchedItem.php?r1=1.17&r2=1.18

Setting wl_notificationtimestamp to '0' got it working again in MySQL.


Version: 1.6.x
Severity: normal
OS: Windows XP
Platform: PC

Details

Reference
bz3104

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:45 PM
bzimport set Reference to bz3104.
bzimport added a subscriber: Unknown Object (MLST).

NULL is the correct way this should be done; '0' is just plain wrong.

I've changed the table definition for MySQL so that this actually can be inserted/
updated properly. Can you clarify if anything else needs to be done still or if just the
failure to do action=watch was the subject of this bug?

mediawiki wrote:

I agree that NULL is the correct way and the table structure of the MySQL table
is the root cause.

As for this bug, nothing else needs to be done in my book, as soon as the new
tables.sql is checked in.

Yes, I also agree.
A special routine checking for NULL value might be needed (according to MySQL
syntax).

Yes, I also agree.
A special routine checking for NULL value might be needed (according to MySQL
syntax).

"SELECT ... foo=null;" is wrong, we need "SELECT ... foo IS NULL;" instead

Such a construction might be needed to become (more) database independent

See
http://cvs.berlios.de/cgi-bin/viewcvs.cgi/enotifwiki/enotifwiki/includes/Database.php?annotate=1.1.1.1

1457 /*
1458 * Returns a string to match in a database query for an
undefined timestamp value
1459 */
1460 function wl_notificationtimestampIsNULL() {
1461 return 'wl_notificationtimestamp = 0'; # for VARCHAR(14)
1462
1463 depending on your table definition it can also be 1464 return 'wl_notificationtimestamp IS NULL'; # for DATETIME
1465
1466 underlying problem: 1467
1468 MySQL queries need different syntax when testing against NULL value 1469 "SELECT ... foo=null;" is wrong, we need "SELECT ... foo
IS NULL;" instead

This is implemented so in EnotifWiki.

Please correct me, if I am wrong.

This has been working for months.