My new hosting provider is running MySQL Version 10.0.31-MariaDB-cll-lve
I have a view that was working fine in MySQL 5.6 but does not work in MariaDB.
I have created a simple cut down version just to show what is causing an error.
I can create the view but I can not use it:
CREATE VIEW `test_date`
AS select (case
when (now() between '2018-01-01 00:00:00' and '2018-06-30 23:59:59')
then '2018-06-30'
else NULL end) - interval 4 month
The error I get when trying to open:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near '21:05:05 between 2018-01-01 00:00:00 and 2018-06-30 23:59:59)
then '2018-06-30' ' at line 1
I can't see anything wrong and it works fine on normal MySQL servers.
I have tried removing the '- interval 4 month' and it works fine:
CREATE VIEW `test_date`
AS select case
when (now() between '2018-01-01 00:00:00' and '2018-06-30 23:59:59')
then '2018-06-30'
else NULL end
I have tried replacing the dates with simple numbers and it works fine:
CREATE VIEW `test_date`
AS select (case
when (3 between 1 and 5)
then '2018-06-30'
else NULL end) - interval 4 month
So what is the real problem here? I am stumped.