mysqlruby-on-railsmariadbconvert-tz

Ruby convert_tz using MariaDB is returning nil


When doing a regular:

select convert_tz(now(), "UTC", "Europe/London")

directly on a MariaDB server, it will produce:

+-------------------------------------------+
| convert_tz(now(), "UTC", "Europe/London") |
+-------------------------------------------+
| 2013-03-07 16:01:32                       |
+-------------------------------------------+

But if done through ruby 1.8.7 or 1.9.3 width:

q = 'select convert_tz(now(), "UTC", "Europe/London")'
ActiveRecord::Base.connection.select_all(q)

it will produce:

"convert_tz(now(), \"UTC\", \"Europe/London\")" => nil

Do the same against a MySQL setup:

q = 'select convert_tz(now(), "UTC", "Europe/London")'
ActiveRecord::Base.connection.select_all(q)

results in:

"convert_tz(now(), \"UTC\", \"Europe/London\")" => "2013-03-07 16:05:14"

Now tested in MySQLWorkbench and the same bad result occurs there, null is returned instead of the converted time.

So I guess it's something in MariaDB or?


Solution

  • Upgrading to 5.5.29-MariaDB solved the problem, so I guess it was related to 5.5.28.