Commit 277aa532 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-25408 JSON_TABLE: AddressSanitizer CHECK failed in Binary_string::realloc_raw

We need to update default values if we change the column's charsets.
parent 991bfebe
...@@ -813,6 +813,7 @@ SUM(o) ...@@ -813,6 +813,7 @@ SUM(o)
NULL NULL
set sql_mode=@save_sql_mode; set sql_mode=@save_sql_mode;
drop table t1; drop table t1;
#
# MDEV-25379 JSON_TABLE: ERROR ON clauses are ignored if a column is not on select list. # MDEV-25379 JSON_TABLE: ERROR ON clauses are ignored if a column is not on select list.
# #
SELECT * FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o FOR ORDINALITY)) AS jt; SELECT * FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o FOR ORDINALITY)) AS jt;
...@@ -822,5 +823,14 @@ ERROR HY000: Field 'a' can't be set for JSON_TABLE 'jt'. ...@@ -822,5 +823,14 @@ ERROR HY000: Field 'a' can't be set for JSON_TABLE 'jt'.
SELECT COUNT(*) FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o FOR ORDINALITY)) AS jt; SELECT COUNT(*) FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o FOR ORDINALITY)) AS jt;
ERROR HY000: Field 'a' can't be set for JSON_TABLE 'jt'. ERROR HY000: Field 'a' can't be set for JSON_TABLE 'jt'.
# #
# MDEV-25408 JSON_TABLE: AddressSanitizer CHECK failed in Binary_string::realloc_raw.
#
SELECT x, COUNT(*) FROM JSON_TABLE( '{}', '$' COLUMNS(
a BIT(14) PATH '$', b CHAR(16) PATH '$', c INT PATH '$[0]', d INT PATH '$[1]', e INT PATH '$[2]',
f INT PATH '$[3]', g INT PATH '$[4]', h INT PATH '$[5]', i INT PATH '$[6]', j INT PATH '$[7]',
x TEXT PATH '$[9]')) AS jt GROUP BY x;
x COUNT(*)
NULL 1
#
# End of 10.6 tests # End of 10.6 tests
# #
...@@ -709,6 +709,7 @@ SELECT SUM(o) FROM t1 JOIN JSON_TABLE(t1.a, '$' COLUMNS(o FOR ORDINALITY)) jt; ...@@ -709,6 +709,7 @@ SELECT SUM(o) FROM t1 JOIN JSON_TABLE(t1.a, '$' COLUMNS(o FOR ORDINALITY)) jt;
set sql_mode=@save_sql_mode; set sql_mode=@save_sql_mode;
drop table t1; drop table t1;
--echo #
--echo # MDEV-25379 JSON_TABLE: ERROR ON clauses are ignored if a column is not on select list. --echo # MDEV-25379 JSON_TABLE: ERROR ON clauses are ignored if a column is not on select list.
--echo # --echo #
--error ER_JSON_TABLE_ERROR_ON_FIELD --error ER_JSON_TABLE_ERROR_ON_FIELD
...@@ -718,6 +719,15 @@ SELECT o FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o F ...@@ -718,6 +719,15 @@ SELECT o FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o F
--error ER_JSON_TABLE_ERROR_ON_FIELD --error ER_JSON_TABLE_ERROR_ON_FIELD
SELECT COUNT(*) FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o FOR ORDINALITY)) AS jt; SELECT COUNT(*) FROM JSON_TABLE ('{}', '$' COLUMNS(a INT PATH '$.*' ERROR ON EMPTY, o FOR ORDINALITY)) AS jt;
--echo #
--echo # MDEV-25408 JSON_TABLE: AddressSanitizer CHECK failed in Binary_string::realloc_raw.
--echo #
SELECT x, COUNT(*) FROM JSON_TABLE( '{}', '$' COLUMNS(
a BIT(14) PATH '$', b CHAR(16) PATH '$', c INT PATH '$[0]', d INT PATH '$[1]', e INT PATH '$[2]',
f INT PATH '$[3]', g INT PATH '$[4]', h INT PATH '$[5]', i INT PATH '$[6]', j INT PATH '$[7]',
x TEXT PATH '$[9]')) AS jt GROUP BY x;
--echo # --echo #
--echo # End of 10.6 tests --echo # End of 10.6 tests
--echo # --echo #
...@@ -1109,6 +1109,7 @@ int Table_function_json_table::setup(THD *thd, TABLE_LIST *sql_table, ...@@ -1109,6 +1109,7 @@ int Table_function_json_table::setup(THD *thd, TABLE_LIST *sql_table,
*/ */
jc->m_field->charset= jc->m_explicit_cs; jc->m_field->charset= jc->m_explicit_cs;
} }
store_record(t, s->default_values);
} }
return FALSE; return FALSE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment