Advertisement:

Author Topic: ManageNews.php newsletter sending error in postgresql  (Read 16465 times)

Offline piercej

  • Newbie
  • *
  • Posts: 8
ManageNews.php newsletter sending error in postgresql
« 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.  ???




Offline piercej

  • Newbie
  • *
  • Posts: 8
Re: ManageNews.php newsletter sending error in postgresql
« Reply #1 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.


Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: ManageNews.php newsletter sending error in postgresql
« Reply #2 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.
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org