Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
11.4
-
None
-
Unexpected results
-
When selecting the result of JSON_ARRAY_INTERSECT from a cursor, result fields where blank due to incorrect setting of the length.
Description
In cursor protocol mode the main.func_json test added in MDEV-36808 fails
|
nocursor -11.4.12 |
$ mysql-test/mtr j
|
worker[01] Using MTR_BUILD_THREAD 300, with reserved ports 19000..19029
|
#
|
# MDEV-36808 json_array_intersect incorrect results after returning NULL in table scan
|
#
|
CREATE TABLE t1 (full text, overlap text);
|
INSERT INTO t1 VALUES ('["2"]', '["2"]'), ('["3"]', '["0"]'), ('["1"]', '["1"]');
|
SELECT full, overlap, json_array_intersect(full, overlap) as jai from t1;
|
full overlap jai
|
["2"] ["2"] ["2"]
|
["3"] ["0"] NULL
|
["1"] ["1"] ["1"]
|
DROP TABLE t1;
|
# End of 11.4 Test
|
main.j [ pass ] 29
|
|
cursor |
$ mysql-test/mtr --cursor-protocol j
|
 |
worker[01] Using MTR_BUILD_THREAD 300, with reserved ports 19000..19029
|
#
|
# MDEV-36808 json_array_intersect incorrect results after returning NULL in table scan
|
#
|
CREATE TABLE t1 (full text, overlap text);
|
INSERT INTO t1 VALUES ('["2"]', '["2"]'), ('["3"]', '["0"]'), ('["1"]', '["1"]');
|
SELECT full, overlap, json_array_intersect(full, overlap) as jai from t1;
|
full overlap jai
|
["2"] ["2"]
|
["3"] ["0"] NULL
|
["1"] ["1"]
|
DROP TABLE t1;
|
# End of 11.4 Test
|
main.j [ pass ] 29
|
Traced to this point and the result is evalued.
(rr)
|
Item::save_str_in_field (this=0x7e3e0166cd40, field=<optimized out>, no_conversions=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/item.cc:7100
|
7100 result=val_str(&str_value);
|
(rr) p str_value
|
$94 = {<Charset> = {m_charset = 0x4d0f2c0 <my_charset_latin1>}, <Binary_string> = {<Sql_alloc> = {<No data fields>}, Ptr = 0x7b6df0b14020 "[\"1\"]", str_length = 5, Alloced_length = 766, extra_alloc = 0,
|
alloced = false, thread_specific = false}, <No data fields>}
|
(rr) bt
|
#0 Item::save_str_in_field (this=0x7e3e0166cd40, field=<optimized out>, no_conversions=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/item.cc:7100
|
#1 0x000000000163e67f in Item::save_in_field (this=0x7e3e0166cd40, field=0x7e3e01675758, no_conversions=false) at /home/dan/repos/mariadb-server-11.4/sql/item.cc:7158
|
#2 0x00000000008be5b3 in fill_record (thd=<optimized out>, table=<optimized out>, ptr=0x7e3e01674ed0, values=<optimized out>, ignore_errors=<optimized out>, use_value=<optimized out>,
|
check_for_computability=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_base.cc:9514
|
#3 0x0000000000e76b37 in select_unit::send_data (this=0x7e3e01444438,
|
values=@0x7e3e0166c5a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7e3e0166c8f8, last = 0x7e3e0166cfb8, elements = 3}, <No data fields>})
|
at /home/dan/repos/mariadb-server-11.4/sql/sql_union.cc:122
|
#4 0x0000000000c1932c in select_result_sink::send_data_with_check (
|
items=@0x7e3e0166c5a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7e3e0166c8f8, last = 0x7e3e0166cfb8, elements = 3}, <No data fields>}, u=<optimized out>, sent=<optimized out>,
|
this=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_class.h:6210
|
#5 end_send (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:25673
|
#6 0x0000000000cac648 in evaluate_join_record (join=<optimized out>, join_tab=0x7e3e01445cc0, error=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:24585
|
#7 0x0000000000bb3c90 in sub_select (join=<optimized out>, join_tab=<optimized out>, end_of_records=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:24389
|
#8 0x0000000000c2f3ed in do_select (join=0x7e3e01444618, procedure=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:23863
|
#9 0x0000000000c2ce1d in JOIN::exec_inner (this=0x7e3e01444618) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:5102
|
#10 0x0000000000c2a5d5 in JOIN::exec (this=0x7e3e01444618) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:4893
|
#11 0x0000000000bb6d66 in mysql_select (thd=<optimized out>, tables=<optimized out>, fields=<optimized out>, conds=<optimized out>, og_num=<optimized out>, order=<optimized out>, group=<optimized out>,
|
having=<optimized out>, proc_param=<optimized out>, select_options=2201187781376, result=<optimized out>, unit=<optimized out>, select_lex=<optimized out>)
|
at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:5416
|
#12 0x0000000000bb5d0a in handle_select (thd=<optimized out>, lex=0x7e3e0166a438, result=<optimized out>, setup_tables_done_option=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_select.cc:643
|
#13 0x0000000000ac17cd in execute_sqlcom_select (thd=0x7e2e01490218, all_tables=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_parse.cc:6222
|
#14 0x0000000000ab46b6 in mysql_execute_command (thd=0x7e2e01490218, is_called_from_prepared_stmt=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_parse.cc:4010
|
#15 0x00000000009585e9 in mysql_open_cursor (thd=thd@entry=0x7e2e01490218, result=0x7cfe0143b570, pcursor=0x7cfe0143b5e0) at /home/dan/repos/mariadb-server-11.4/sql/sql_cursor.cc:72
|
#16 0x0000000000b6aea8 in Prepared_statement::execute (this=<optimized out>, expanded_query=<optimized out>, open_cursor=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_prepare.cc:5096
|
#17 0x0000000000b61442 in Prepared_statement::execute_loop (this=0x7cfe0143b498, expanded_query=<optimized out>, open_cursor=<optimized out>, packet=<optimized out>, packet_end=<optimized out>)
|
at /home/dan/repos/mariadb-server-11.4/sql/sql_prepare.cc:4504
|
#18 0x0000000000b5fa23 in mysql_stmt_execute_common (thd=0x7e2e01490218, stmt_id=<optimized out>, packet=<optimized out>, packet_end=<optimized out>, cursor_flags=<optimized out>, bulk_op=<optimized out>,
|
read_types=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_prepare.cc:3406
|
#19 0x0000000000b5f0bc in mysqld_stmt_execute (thd=<optimized out>, packet_arg=<optimized out>, packet_length=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_prepare.cc:3177
|
#20 0x0000000000a8eb3a in dispatch_command (command=<optimized out>, thd=0x7e2e01490218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>)
|
at /home/dan/repos/mariadb-server-11.4/sql/sql_parse.cc:1849
|
#21 0x0000000000a98320 in do_command (thd=0x7e2e01490218, blocking=<optimized out>) at /home/dan/repos/mariadb-server-11.4/sql/sql_parse.cc:1433
|
#22 0x0000000001018c2d in do_handle_one_connection (connect=0x7bee013e35b8, connect@entry=0x7bee013e3538, put_in_cache=true) at /home/dan/repos/mariadb-server-11.4/sql/sql_connect.cc:1497
|
#23 0x0000000001018759 in handle_one_connection (arg=arg@entry=0x7bee013e3538) at /home/dan/repos/mariadb-server-11.4/sql/sql_connect.cc:1409
|
#24 0x0000000001f8eb91 in pfs_spawn_thread (arg=0x7cde013e7418) at /home/dan/repos/mariadb-server-11.4/storage/perfschema/pfs.cc:2201
|
#25 0x00000000005ddbcb in asan_thread_start(void*) ()
|
#26 0x00007f6e02078759 in start_thread () from /lib64/libc.so.6
|
#27 0x00007f6e020fc734 in clone () from /lib64/libc.so.6
|
Attachments
Issue Links
- is caused by
-
MDEV-36808 json_array_intersect incorrect results after returning NULL in table scan
-
- Closed
-
- relates to
-
MDEV-37864 mysql-test/mtr --cursor main.func_json fails
-
- Closed
-