http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7802

--- Comment #28 from Galen Charlton <[email protected]> ---
Comment on attachment 22817
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=22817
Bug 7802: Followup Remove CUR_DATE() and CURRENT_DATE() MySQLisms, replace by
CAST(now() AS date).

Review of attachment 22817:
 --> 
(http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=7802&attachment=22817)
-----------------------------------------------------------------

::: C4/Koha.pm
@@ +1431,4 @@
>          # Fall through... we also return a random quote as a catch-all if 
> all else fails
>      }
>      else {
> +        $query = 'SELECT * FROM quotes WHERE timestamp LIKE 
> CONCAT(CAST(now() AS date),\'%\') ORDER BY timestamp DESC LIMIT 0,1';

Ironically, PostgreSQL will happily accept CURRENT_DATE (without the
parentheses).  It won't accept "LIMIT 0,1".  It also won't like trying to
compare a timestamp to a string datatype.

Closer to the mark (as in, I've actually tested this on both MariaDB and Pg is
"select * from quotes where cast(now() as date) = cast(timestamp as date) limit
1 offset 0;"

A broader point: I don't think that the point should be to search-and-replace
fragments of non-portable SQL.  Actually ensuring that the output is portable
would be more on target.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to