boolean value true/false returned by JS stored function is interpreted as a string value.
General
Escalation
General
Escalation
Description
None
Environment
In MySQL, Upon creating stored function with return type boolean, it actually gets created with TINYINT return type.
In case of the normal stored function value true and false returned by the function are interpreted as 1 and 0 respectively. Whereas in case of JS stored function, the return value true/false is being interpreted as string true/false and the function throws an ERROR due to Incorrect Value to Integer.
In MySQL, Upon creating stored function with return type boolean, it actually gets created with TINYINT return type.
In case of the normal stored function value true and false returned by the function are interpreted as 1 and 0 respectively. Whereas in case of JS stored function, the return value true/false is being interpreted as string true/false and the function throws an ERROR due to Incorrect Value to Integer.
mysql> CREATE FUNCTION test_1() RETURNS boolean DETERMINISTIC RETURN false; Query OK, 0 rows affected (0.02 sec) mysql> SELECT test_1(); +----------+ | test_1() | +----------+ | 0 | +----------+ mysql> CREATE FUNCTION test_2() RETURNS boolean DETERMINISTIC LANGUAGE JS AS $$ return true; $$; Query OK, 0 rows affected (0.02 sec) mysql> SELECT test_2(); ERROR 1366 (HY000): Incorrect integer value: 'true' for column 'test_2()' at row 1