Commit abdc39b0 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-25143 JSON_TABLE: Server crashes in handler::print_error / hton_name upon ERROR ON EMPTY.

should return some error code from ha_json_table::rnd_pos() not just 1.
parent 99fc076f
...@@ -508,5 +508,10 @@ a ...@@ -508,5 +508,10 @@ a
EXECUTE stmt; EXECUTE stmt;
a a
# #
# MDEV-JSON_TABLE: Server crashes in handler::print_error / hton_name upon ERROR ON EMPTY
#
SELECT a, b FROM JSON_TABLE('[]', '$' COLUMNS (a FOR ORDINALITY, b INT PATH '$[*]' ERROR ON EMPTY)) AS t ORDER BY a;
ERROR HY000: Field 'b' can't be set for JSON_TABLE 't'.
#
# End of 10.6 tests # End of 10.6 tests
# #
...@@ -395,6 +395,12 @@ PREPARE stmt FROM "SELECT * FROM (SELECT * FROM JSON_TABLE(LOAD_FILE('x'), '$' C ...@@ -395,6 +395,12 @@ PREPARE stmt FROM "SELECT * FROM (SELECT * FROM JSON_TABLE(LOAD_FILE('x'), '$' C
EXECUTE stmt; EXECUTE stmt;
EXECUTE stmt; EXECUTE stmt;
--echo #
--echo # MDEV-JSON_TABLE: Server crashes in handler::print_error / hton_name upon ERROR ON EMPTY
--echo #
--error ER_JSON_TABLE_ERROR_ON_FIELD
SELECT a, b FROM JSON_TABLE('[]', '$' COLUMNS (a FOR ORDINALITY, b INT PATH '$[*]' ERROR ON EMPTY)) AS t ORDER BY a;
--echo # --echo #
--echo # End of 10.6 tests --echo # End of 10.6 tests
--echo # --echo #
...@@ -445,7 +445,7 @@ int ha_json_table::fill_column_values(uchar * buf, uchar *pos) ...@@ -445,7 +445,7 @@ int ha_json_table::fill_column_values(uchar * buf, uchar *pos)
int ha_json_table::rnd_pos(uchar * buf, uchar *pos) int ha_json_table::rnd_pos(uchar * buf, uchar *pos)
{ {
return fill_column_values(buf, pos); return fill_column_values(buf, pos) ? HA_ERR_TABLE_IN_FK_CHECK : 0;
} }
......
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