Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => PostgreSQL and SQLite Support => Topic started by: piercej on October 16, 2014, 08:15:03 PM

Title: ManageNews.php newsletter sending error in postgresql
Post by: piercej on October 16, 2014, 08:15:03 PM
line 375 of Sources/ManageNews.php throws an error on postgresql 9.3 when you try and email a newsletter.


Database Error
ERROR: COALESCE types integer and boolean cannot be matched
LINE 6: AND (COALESCE(bg.expire_time, 1=1) OR bg.expire_time > 14...
^
File: /home/observers/smf/Sources/ManageNews.php
Line: 375

(this is on SMF 2.0.7)

I fixed this line to read...

                        AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})

and it works, and IMHO, is easier to read.    8)

afaik, this should work in MySQL too, as IS NULL is standard sql.  COALESCE(INTEGER, BOOLEAN) doesn't make any sense to me.  ???



Title: Re: ManageNews.php newsletter sending error in postgresql
Post by: piercej on October 17, 2014, 03:16:38 AM
fyi, this code is unchanged in 2.0.8 (yeah, I should have upgraded /before/ I posted).

I haven't actually tested my alternate sql in mysql but it SHOULD work as mysql supports the standard construct IS NULL.

Title: Re: ManageNews.php newsletter sending error in postgresql
Post by: Oldiesmann on October 25, 2014, 02:36:22 PM
I'm as stumped as you are as to why COALESCE() is used there. It's already been changed to IS NULL for 2.1 though.