1

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!

mvo
  • 1,138
  • 10
  • 18
  • 1
    for kicks, try assigning to some other system var , e.g. `set session some_var_thats_irrelevant=greatest(...)` so you can tell WHICH of the two wait_timeouts the error message is talking about. – Marc B Feb 03 '16 at 20:56
  • @MarcB good point - ok let's try: "SET SESSION interactive_timeout = GREATEST(28000, @@wait_timeout)" results in "#1232 - Incorrect argument type to variable 'interactive_timeout'" – mvo Feb 03 '16 at 21:00
  • 1
    further test: `set foo=greatest(2800, @@wait_timeout)`, see if it's something specific about setting session vars, or just a var setting bug in general. could be mariadb's got a regression that barfs on the expression being on the RHS of an assignment – Marc B Feb 03 '16 at 21:04
  • Mhh.. That one does work: ``set @foo=greatest(2800, @@wait_timeout)`` – mvo Feb 03 '16 at 21:09
  • 3
    I'd go file it as a bug against mariadb. – Marc B Feb 03 '16 at 21:10
  • Thanks for your support so far. I did file a bug and will report if there are any news. – mvo Feb 03 '16 at 21:38

1 Answers1

1

As some have guessed correctly: it's a bug (now confirmed) that was introduced recently.

For more details have a look at the mariadb issue tracker: https://jira.mariadb.org/browse/MDEV-9516

Update (2016-03-21)

Regarding the bugtracker the problem seems fixed in 10.1.13.

Community
  • 1
  • 1
mvo
  • 1,138
  • 10
  • 18