why do the following queries work on Maria DB (10.1.9)...
SET SESSION wait_timeout = 28000;
SET SESSION wait_timeout = @@wait_timeout;
SELECT GREATEST(28000, @@wait_timeout);
... but that one not?
SET SESSION wait_timeout = GREATEST(28000, @@wait_timeout)
It throws a type error:
#1232 - Incorrect argument type to variable 'wait_timeout`
Allthough this error can be resolved by replacing @wait_timeout
with CAST(@@wait_timeout AS INT)
or CONVERT(@@wait_timeout, SIGNED)
(the latter works on MySQL as well) to the query I wonder why the second and third query work.
What's going on here? It can't be the GREATEST operation because query 3 works and it can't be a differing variable type because the (implicit) conversion would fail in query 2 (it should have the same type anyhow). The same thing happens with other system variables as well.
By the way: The same query works under MySQL (tried it in a SQLfiddle with MySQL version 5.6) so this is an inconsistency between MariaDB and MySQL.
Any help appreciated!