You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#21828321: JSON FUNCS CALL DBUG_ABORT OR EXIT() ON WINDOWS!
If LEAST or GREATEST is called with only JSON arguments, and the
result of the call is passed as an argument to a JSON function, an
error is raised in release builds and an assert failure in debug
builds.
The LEAST and GREATEST functions don't have any special handling of
JSON values currently. JSON arguments are handled as if they were
strings, and the result is returned as a string. If all the arguments
have type JSON, however, the return type of the function will be set
to MYSQL_TYPE_JSON. If the result is passed as an argument to a JSON
function, the JSON function will attempt to call val_json() on the
result, since it appears to be a JSON value. Since the corresponding
Item subclass (Item_func_min_max) does not override Item::val_json(),
an error or assert failure is raised when val_json() is called.
The fix changes the return type of the function call from JSON to
string in the case where all arguments are JSON values. This way, the
receiving JSON function is not led to believe it's a JSON value and
does not call val_json() on it.
This patch also makes LEAST and GREATEST raise a "not supported yet"
warning if one of the arguments is JSON. This is meant as a
notification that these operators have not yet been updated to use the
JSON comparator, and may therefore give other results than expected.
The warning is raised by BETWEEN and IN as well, since those operators
also haven't been updated to use the JSON comparator to compare JSON
values.
Warning 1235 This version of MySQL doesn't yet support 'comparison of JSON in the IN operator'
284
+
Warning 1235 This version of MySQL doesn't yet support 'comparison of JSON in the IN operator'
283
285
Warning 3156 Invalid JSON value for CAST to DOUBLE: '{"a": 2}' from j at row 2
284
286
Warning 3156 Invalid JSON value for CAST to DOUBLE: '[1, 2]' from j at row 35
285
287
Warning 3156 Invalid JSON value for CAST to DOUBLE: '{"a": "b", "c": "d", "ab": "abc", "bc": ["x", "y"]}' from j at row 36
@@ -10978,6 +10980,8 @@ insert into tt(j) values (cast(1 as json)), (null);
10978
10980
select sum( distinct j ) from tt group by j having j in ( avg( 1 ), 1 + j);
10979
10981
sum( distinct j )
10980
10982
1
10983
+
Warnings:
10984
+
Warning 1235 This version of MySQL doesn't yet support 'comparison of JSON in the IN operator'
10981
10985
SELECT JSON_ARRAY(j), COUNT(*) FROM tt GROUP BY j, i WITH ROLLUP;
10982
10986
JSON_ARRAY(j) COUNT(*)
10983
10987
[null] 1
@@ -13387,3 +13391,16 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
13387
13391
Warnings:
13388
13392
Note 1003 /* select#1 */ select json_object('c',json_extract(`test`.`t1`.`f1`,'$.b')) AS `f2` from `test`.`t1` having (json_type(json_extract(`f2`,'$.c')) <> 'NULL')
13389
13393
DROP TABLE t1;
13394
+
#
13395
+
# Bug#21828321: JSON FUNCS CALL DBUG_ABORT OR EXIT() ON WINDOWS!
0 commit comments