$ cat test_script.sql set names utf8; select version(); select @a:=time('1:11'), charset(time('1:11')), charset(@a), collation(@a); select @a:=sec_to_time(1), charset(sec_to_time(1)), charset(@a), collation(@a); select @a:=date('11-01-01'), charset(date('11-01-01')), charset(@a), collation(@a); select @a:=from_unixtime(1), charset(from_unixtime(1)), charset(@a), collation(@a); select @a:=time('1:11'), @a < time('2:22'); $ $ mysql -t < test_script.sql +-----------+ | version() | +-----------+ | 5.5.11 | +-----------+ +------------------+-----------------------+-------------+-----------------+ | @a:=time('1:11') | charset(time('1:11')) | charset(@a) | collation(@a) | +------------------+-----------------------+-------------+-----------------+ | 01:11:00 | binary | utf8 | utf8_general_ci | +------------------+-----------------------+-------------+-----------------+ +--------------------+-------------------------+-------------+-----------------+ | @a:=sec_to_time(1) | charset(sec_to_time(1)) | charset(@a) | collation(@a) | +--------------------+-------------------------+-------------+-----------------+ | 00:00:01 | binary | utf8 | utf8_general_ci | +--------------------+-------------------------+-------------+-----------------+ +----------------------+---------------------------+-------------+-----------------+ | @a:=date('11-01-01') | charset(date('11-01-01')) | charset(@a) | collation(@a) | +----------------------+---------------------------+-------------+-----------------+ | 2011-01-01 | binary | utf8 | utf8_general_ci | +----------------------+---------------------------+-------------+-----------------+ +----------------------+---------------------------+-------------+-----------------+ | @a:=from_unixtime(1) | charset(from_unixtime(1)) | charset(@a) | collation(@a) | +----------------------+---------------------------+-------------+-----------------+ | 1969-12-31 19:00:01 | binary | utf8 | utf8_general_ci | +----------------------+---------------------------+-------------+-----------------+ ERROR 1267 (HY000) at line 7: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,NUMERIC) for operation '<' $ $ # I changed server versions here $ $ mysql -t < test_script.sql +-----------+ | version() | +-----------+ | 5.1.57 | +-----------+ +------------------+-----------------------+-------------+---------------+ | @a:=time('1:11') | charset(time('1:11')) | charset(@a) | collation(@a) | +------------------+-----------------------+-------------+---------------+ | 01:11:00 | binary | binary | binary | +------------------+-----------------------+-------------+---------------+ +--------------------+-------------------------+-------------+---------------+ | @a:=sec_to_time(1) | charset(sec_to_time(1)) | charset(@a) | collation(@a) | +--------------------+-------------------------+-------------+---------------+ | 00:00:01 | binary | binary | binary | +--------------------+-------------------------+-------------+---------------+ +----------------------+---------------------------+-------------+---------------+ | @a:=date('11-01-01') | charset(date('11-01-01')) | charset(@a) | collation(@a) | +----------------------+---------------------------+-------------+---------------+ | 2011-01-01 | binary | binary | binary | +----------------------+---------------------------+-------------+---------------+ +----------------------+---------------------------+-------------+---------------+ | @a:=from_unixtime(1) | charset(from_unixtime(1)) | charset(@a) | collation(@a) | +----------------------+---------------------------+-------------+---------------+ | 1969-12-31 19:00:01 | binary | binary | binary | +----------------------+---------------------------+-------------+---------------+ +------------------+-------------------+ | @a:=time('1:11') | @a < time('2:22') | +------------------+-------------------+ | 01:11:00 | 1 | +------------------+-------------------+ $