Closed (fixed)
Project:
Drupal core
Version:
4.6.3
Component:
forum.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Oct 2005 at 10:37 UTC
Updated:
11 Nov 2005 at 14:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
intosi commentedThe attached patch fixes it on the database-level, by adding two custom functions to the database definition.
Comment #2
Cvbge commentedHi,
there already is IF() function in drupal's database.pgsql. The problem is that it expects a bool type not an integer.
Adding another IF() function that expects integer would fix the problem, but that would require database update in 4.6 series, and I'd prefer not to do it.
Another solution is to change the sql that calls the if() function from
IF(l.last_comment_uid, ...)toIF(l.last_comment_uid != 0, .... Attached patch implements this.last_comment_uid is defined as NOT NULL DEFAULT 0, so it contains only integers. IF(foo, ...) checks if foo is 0 or NULL, so it is the same as IF(foo != 0, ...) in this case (because foo can't be NULL).
I've tested that it works for postgresql.
Comment #3
Cvbge commentedSince the situation is the same for HEAD here's the patch for that version.
Comment #4
Cvbge commentedIf anyone wanted to test the patch here are the instructions on how to reproduce the bug: http://drupal.org/node/28996
Comment #5
gerhard killesreiter commentedquery gives same results for mysql.
Comment #6
dries commentedCommited to HEAD and DRUPAL-4-6. Thanks.
Comment #7
(not verified) commented