The above results are wrong.

The expected results would be:

The same problem is observed with TIME data type:

The expected result is:

The result in string context is also wrong:

The expected result is '2001-01-01 00:00:00'.

IF() has a similar problem:

The expected results are 20010101000000 and '2001-01-01 00:00:00'.

So does IFNULL:

The expected result is 20010101000000 and '2001-01-01 00:00:00'.

CASE has a similar problem:

The expected results are 20010101000000 and '2001-01-01 00:00:00'.

A related problem in CASE:

Columns c2 is too short. It should be enough to fit DATETIME(6) values,

so it should be varbinary(26) in 5.3 and varchar(26) in 5.5+.

COALESCE has the same problem:

The expected length for "c2" is 26, which is a minimum length to fit a datetime(6) value.

The same problem is repeatable with IFNULL:

and IF:

None