[MDEV-22295] JSON_TABLE: Server crashes in Select_limit_counters::get_select_limit upon json_table referencing unknown table Created: 2020-04-18  Updated: 2020-04-27  Resolved: 2020-04-27

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-17399 Add support for JSON_TABLE Closed

 Description   

select * from json_table(t.a, "$" columns(a for ordinality)) x;
ERROR 2013 (HY000): Lost connection to MySQL server during query

bb-10.5-hf 6dfb3fab2

#3  <signal handler called>
#4  0x0000560e423759e9 in Select_limit_counters::get_select_limit (this=0x788) at /data/src/bb-10.5-hf/sql/sql_limit.h:67
#5  0x0000560e424f289f in JOIN::optimize_inner (this=0x62b000087ae8) at /data/src/bb-10.5-hf/sql/sql_select.cc:1805
#6  0x0000560e424f0a87 in JOIN::optimize (this=0x62b000087ae8) at /data/src/bb-10.5-hf/sql/sql_select.cc:1612
#7  0x0000560e42510fa0 in mysql_select (thd=0x62b00007e270, tables=0x62b000086ab0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000087ab8, unit=0x62b0000821b8, select_lex=0x62b000085380) at /data/src/bb-10.5-hf/sql/sql_select.cc:4656
#8  0x0000560e424e3430 in handle_select (thd=0x62b00007e270, lex=0x62b0000820f8, result=0x62b000087ab8, setup_tables_done_option=0) at /data/src/bb-10.5-hf/sql/sql_select.cc:416
#9  0x0000560e42455a48 in execute_sqlcom_select (thd=0x62b00007e270, all_tables=0x62b000086ab0) at /data/src/bb-10.5-hf/sql/sql_parse.cc:6138
#10 0x0000560e424444fb in mysql_execute_command (thd=0x62b00007e270) at /data/src/bb-10.5-hf/sql/sql_parse.cc:3904
#11 0x0000560e42460836 in mysql_parse (thd=0x62b00007e270, rawbuf=0x62b000085290 "select * from json_table(t.a, \"$\" columns(a for ordinality)) x", length=62, parser_state=0x7fc9b438da90, is_com_multi=false, is_next_command=false) at /data/src/bb-10.5-hf/sql/sql_parse.cc:7918
#12 0x0000560e4243708c in dispatch_command (command=COM_QUERY, thd=0x62b00007e270, packet=0x6290000d7271 "select * from json_table(t.a, \"$\" columns(a for ordinality)) x", packet_length=62, is_com_multi=false, is_next_command=false) at /data/src/bb-10.5-hf/sql/sql_parse.cc:1844
#13 0x0000560e42433ace in do_command (thd=0x62b00007e270) at /data/src/bb-10.5-hf/sql/sql_parse.cc:1363
#14 0x0000560e4284c072 in do_handle_one_connection (connect=0x6100000046b0, put_in_cache=true) at /data/src/bb-10.5-hf/sql/sql_connect.cc:1422
#15 0x0000560e4284b908 in handle_one_connection (arg=0x6100000045b0) at /data/src/bb-10.5-hf/sql/sql_connect.cc:1319
#16 0x00007fc9d7fd6fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#17 0x00007fc9d78254cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Elena Stepanova [ 2020-04-18 ]

Same with known table, unknown column

create table t (a text);
select * from t, json_table(t.b, '$' columns (f for ordinality)) as jt;

Same with aggregate function

create table t (a text);
select * from t, json_table(group_concat(t.a), '$' columns (f for ordinality)) as jt;

Generated at Thu Feb 08 09:13:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.