Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIEW fails with UNION of versioned tables #269

Closed
kevgs opened this issue Sep 13, 2017 · 9 comments
Closed

VIEW fails with UNION of versioned tables #269

kevgs opened this issue Sep 13, 2017 · 9 comments
Assignees

Comments

@kevgs
Copy link

kevgs commented Sep 13, 2017

Reproduce

create or replace table t1 (a int) with system versioning;
create or replace view v as select * from t1 union select * from t1;

Result

create view v as select * from t1 union select * from t1' failed: 1222: The used SELECT statements have a different number of columns

Expected

No error, empty resultset.

@midenok midenok self-assigned this Sep 13, 2017
@midenok
Copy link

midenok commented Sep 13, 2017

#0  my_message (error=1222, str=0x555557b04253 "The used SELECT statements have a different number of columns", MyFlags=0) at /home/midenok/src/mariadb/midenok/src/mysys/my_error.c:196
#1  0x0000555555c4ba95 in st_select_lex_unit::prepare (this=0x7fff8c0046e8, thd_arg=0x7fff8c000b00, sel_result=0x0, additional_options=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:839
#2  0x0000555555c59d6c in mysql_create_view (thd=0x7fff8c000b00, views=0x7fff8c011120, mode=VIEW_CREATE_OR_REPLACE) at /home/midenok/src/mariadb/midenok/src/sql/sql_view.cc:664
#3  0x0000555555b6734e in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6044
#4  0x0000555555b6bdd8 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902
836           if (types.elements != sl->item_list.elements)
837           {
838             my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
839                        ER_THD(thd, ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT),MYF(0));
840             goto err;
841           }
(gdb) p types.elements
$1 = 3
(gdb)  p sl->item_list.elements
$2 = 1

@midenok
Copy link

midenok commented Sep 13, 2017

1. types.elements filled

#0  List<Item>::push_back (this=0x7fff8c004db0, a=0x7fff8c014158) at /home/midenok/src/mariadb/midenok/src/sql/sql_list.h:523
#1  0x0000555555c4ba24 in st_select_lex_unit::prepare (this=0x7fff8c0046e8, thd_arg=0x7fff8c000b00, sel_result=0x0, additional_options=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:828
#2  0x0000555555c59d6c in mysql_create_view (thd=0x7fff8c000b00, views=0x7fff8c011120, mode=VIEW_CREATE_OR_REPLACE) at /home/midenok/src/mariadb/midenok/src/sql/sql_view.cc:664
#3  0x0000555555b6734e in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6044
#4  0x0000555555b6bdd8 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902
822           List_iterator_fast<Item> it(sl->item_list);
823           Item *item_tmp;
824           while ((item_tmp= it++))
825           {
826             /* Error's in 'new' will be detected after loop */
827             types.push_back(new (thd_arg->mem_root)
828                             Item_type_holder(thd_arg, item_tmp));
829           }

frame 1

(gdb) p sl->item_list.elements
$11 = 3
(gdb) p sl
$12 = (SELECT_LEX *) 0x7fff8c004e48

2. types.elements compared

#0  st_select_lex_unit::prepare (this=0x7fff8c0046e8, thd_arg=0x7fff8c000b00, sel_result=0x0, additional_options=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:836
#1  0x0000555555c59d6c in mysql_create_view (thd=0x7fff8c000b00, views=0x7fff8c011120, mode=VIEW_CREATE_OR_REPLACE) at /home/midenok/src/mariadb/midenok/src/sql/sql_view.cc:664
#2  0x0000555555b6734e in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6044
#3  0x0000555555b6bdd8 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902
(gdb) p sl
$17 = (SELECT_LEX *) 0x7fff8c011ee0

@midenok
Copy link

midenok commented Sep 13, 2017

Seems like wildcard is wrongly expanded for UNION.

@midenok
Copy link

midenok commented Sep 13, 2017

insert_fields() skips system fields for both selects.

@midenok midenok added this to the 0.12: Multi-schema SELECT milestone Sep 13, 2017
@midenok
Copy link

midenok commented Sep 13, 2017

1-st item_list.empty() is 6.
2-nd item_list.empty() is 23, 39.

@midenok
Copy link

midenok commented Sep 13, 2017

1. 1-st item_list.empty() (break 6)

#0  base_list::empty (this=0x7fff8c004f78) at /home/midenok/src/mariadb/midenok/src/sql/sql_list.h:180
#1  0x0000555555b443f1 in st_select_lex::init_query (this=0x7fff8c004e48) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:2203
#2  0x0000555555b40926 in LEX::start (this=0x7fff8c004620, thd_arg=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:683
#3  0x0000555555b407e2 in lex_start (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:658
#4  0x0000555555b6bbb4 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7842

2. 1-st item pushed

#0  List<Item>::push_back (this=0x7fff8c004f78, a=0x7fff8c011758, mem_root=0x7fff8c005c88) at /home/midenok/src/mariadb/midenok/src/sql/sql_list.h:525
#1  0x0000555555b453ec in st_select_lex::add_item_to_list (this=0x7fff8c004e48, thd=0x7fff8c000b00, item=0x7fff8c011758) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:2703
#2  0x0000555555b54dd9 in add_item_to_list (thd=0x7fff8c000b00, item=0x7fff8c011758) at /home/midenok/src/mariadb/midenok/src/sql/sql_class.h:5805
#3  0x0000555555d5f1d2 in MYSQLparse (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_yacc.yy:8980
#4  0x0000555555b70c3b in parse_sql (thd=0x7fff8c000b00, parser_state=0x7fffe571b6b0, creation_ctx=0x0, do_pfs_digest=true) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:9932
#5  0x0000555555b6bc4a in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7855
(gdb) p item->name
$32 = 0x555556766d01 "*"

3. 2-nd item_list.empty() (break 39)

#0  base_list::empty (this=0x7fff8c012010) at /home/midenok/src/mariadb/midenok/src/sql/sql_list.h:180
#1  0x0000555555b443f1 in st_select_lex::init_query (this=0x7fff8c011ee0) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:2203
#2  0x0000555555b6b48a in mysql_new_select (lex=0x7fff8c004620, move_down=false, select_lex=0x7fff8c011ee0) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7559
#3  0x0000555555d4c568 in LEX::add_select_to_union_list (this=0x7fff8c004620, is_union_distinct=true, type=UNION_TYPE, is_top_level=true) at /home/midenok/src/mariadb/midenok/src/sql/sql_yacc.yy:562
#4  0x0000555555d76a1c in MYSQLparse (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_yacc.yy:16490
#5  0x0000555555b70c3b in parse_sql (thd=0x7fff8c000b00, parser_state=0x7fffe571b6b0, creation_ctx=0x0, do_pfs_digest=true) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:9932
#6  0x0000555555b6bc4a in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7855

4. 2-nd item pushed

#0  List<Item>::push_back (this=0x7fff8c004f78, a=0x7fff8c013050) at /home/midenok/src/mariadb/midenok/src/sql/sql_list.h:523
#1  0x0000555555b51590 in st_select_lex::vers_push_field (this=0x7fff8c004e48, thd=0x7fff8c000b00, table=0x7fff8c011898, field_name=0x7fff8c09751b "sys_trx_start") at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:7055
#2  0x0000555555c59a48 in mysql_create_view (thd=0x7fff8c000b00, views=0x7fff8c011120, mode=VIEW_CREATE_OR_REPLACE) at /home/midenok/src/mariadb/midenok/src/sql/sql_view.cc:581
#3  0x0000555555b6734e in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6044
#4  0x0000555555b6bdd8 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902
(gdb) p fld->name
$33 = 0x7fff8c09751b "sys_trx_start"

5. 3-rd item pushed

#0  List<Item>::push_back (this=0x7fff8c004f78, a=0x7fff8c013158) at /home/midenok/src/mariadb/midenok/src/sql/sql_list.h:523
#1  0x0000555555b51590 in st_select_lex::vers_push_field (this=0x7fff8c004e48, thd=0x7fff8c000b00, table=0x7fff8c011898, field_name=0x7fff8c097529 "sys_trx_end") at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:7055
#2  0x0000555555c59a8e in mysql_create_view (thd=0x7fff8c000b00, views=0x7fff8c011120, mode=VIEW_CREATE_OR_REPLACE) at /home/midenok/src/mariadb/midenok/src/sql/sql_view.cc:583
#3  0x0000555555b6734e in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6044
#4  0x0000555555b6bdd8 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "create or replace view v as select * from t1 union select * from t1", length=67, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902
(gdb) p fld->name
$34 = 0x7fff8c097529 "sys_trx_end"

@midenok midenok changed the title VIEW do not work with UNION of system-versioned tables VIEW fails with UNION of system-versioned tables Sep 13, 2017
@midenok midenok changed the title VIEW fails with UNION of system-versioned tables VIEW fails with UNION of versioned tables Sep 13, 2017
@midenok
Copy link

midenok commented Sep 14, 2017

break sql_union.cc:828
  commands
    p &sl->item_list
    p &sl->next_select()->item_list
  end

break List<Item>::push_back
set $push1=$bpnum
bd $push1

break List<Item>::push_back
set $push2=$bpnum
bd $push2

break List<Item>::empty
  commands
    bt
    bd $empty2
    c
  end

set $empty2=$bpnum
bd $empty2

break List<Item>::empty
  commands
    bt
    bd $empty1
    be $empty2
    ignore $empty2 32
    set $list1=this
    be $push1
    condition $push1 $list1 == this
    c
  end

set $empty1=$bpnum
bd $empty1

break mysql_parse
  commands
    be $empty1
    ignore $empty1 5
    c
  end

@midenok
Copy link

midenok commented Sep 14, 2017

TABLE alloced for derived

#0  0x0000555555bcbc5a in create_tmp_table (thd=0x7fff8c000b00, param=0x7fff8c014358, fields=..., group=0x0, distinct=false, save_sum_fields=true, select_options=2416188160, rows_limit=18446744073709551615, table_alias=0x7fff8c013458 "s", do_not_open=true, keep_row_order=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:16773
#1  0x0000555555c4a214 in select_unit::create_result_table (this=0x7fff8c014320, thd_arg=0x7fff8c000b00, column_types=0x7fff8c011cd0, is_union_distinct=false, options=2416188160, alias=0x7fff8c013458 "s", bit_fields_as_long=false, create_table=false, keep_row_order=false, hidden=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:374
#2  0x0000555555b26ba1 in mysql_derived_prepare (thd=0x7fff8c000b00, lex=0x7fff8c004620, derived=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:881
#3  0x0000555555b251fb in mysql_handle_single_derived (lex=0x7fff8c004620, derived=0x7fff8c013498, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:197
#4  0x0000555555c76b13 in TABLE_LIST::handle_derived (this=0x7fff8c013498, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/table.cc:7931
#5  0x0000555555b477bd in st_select_lex::handle_derived (this=0x7fff8c004e48, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:4008
#6  0x0000555555ba04a3 in JOIN::prepare (this=0x7fff8c013bc0, tables_init=0x7fff8c013498, wild_num=1, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fff8c004e48, unit_arg=0x7fff8c0046e8) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:1070
#7  0x0000555555bab2db in mysql_select (thd=0x7fff8c000b00, tables=0x7fff8c013498, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff8c013ba0, unit=0x7fff8c0046e8, select_lex=0x7fff8c004e48) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:4055
#8  0x0000555555b9d7a6 in handle_select (thd=0x7fff8c000b00, lex=0x7fff8c004620, result=0x7fff8c013ba0, setup_tables_done_option=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:363
#9  0x0000555555b68ab3 in execute_sqlcom_select (thd=0x7fff8c000b00, all_tables=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6455
#10 0x0000555555b60787 in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:3574
#11 0x0000555555b6bdf4 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "select * from (select emp_id from emp for system_time all union select emp_id from emp ) as s", length=93, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902

TABLE_SHARE init for derived

#0  init_tmp_table_share (thd=0x7fff8c000b00, share=0x7fff8c145768, key=0x5555566bd934 "", key_length=0, table_name=0x7fff8c146008 "/tmp/#sql_9bf_1", path=0x7fff8c146008 "/tmp/#sql_9bf_1") at /home/midenok/src/mariadb/midenok/src/sql/table.cc:394
#1  0x0000555555bcc038 in create_tmp_table (thd=0x7fff8c000b00, param=0x7fff8c014358, fields=..., group=0x0, distinct=false, save_sum_fields=true, select_options=2416188160, rows_limit=18446744073709551615, table_alias=0x7fff8c013458 "s", do_not_open=true, keep_row_order=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:16832
#2  0x0000555555c4a214 in select_unit::create_result_table (this=0x7fff8c014320, thd_arg=0x7fff8c000b00, column_types=0x7fff8c011cd0, is_union_distinct=false, options=2416188160, alias=0x7fff8c013458 "s", bit_fields_as_long=false, create_table=false, keep_row_order=false, hidden=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:374
#3  0x0000555555b26ba1 in mysql_derived_prepare (thd=0x7fff8c000b00, lex=0x7fff8c004620, derived=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:881
#4  0x0000555555b251fb in mysql_handle_single_derived (lex=0x7fff8c004620, derived=0x7fff8c013498, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:197
#5  0x0000555555c76b13 in TABLE_LIST::handle_derived (this=0x7fff8c013498, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/table.cc:7931
#6  0x0000555555b477bd in st_select_lex::handle_derived (this=0x7fff8c004e48, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:4008
#7  0x0000555555ba04a3 in JOIN::prepare (this=0x7fff8c013bc0, tables_init=0x7fff8c013498, wild_num=1, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fff8c004e48, unit_arg=0x7fff8c0046e8) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:1070
#8  0x0000555555bab2db in mysql_select (thd=0x7fff8c000b00, tables=0x7fff8c013498, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff8c013ba0, unit=0x7fff8c0046e8, select_lex=0x7fff8c004e48) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:4055
#9  0x0000555555b9d7a6 in handle_select (thd=0x7fff8c000b00, lex=0x7fff8c004620, result=0x7fff8c013ba0, setup_tables_done_option=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:363
#10 0x0000555555b68ab3 in execute_sqlcom_select (thd=0x7fff8c000b00, all_tables=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6455
#11 0x0000555555b60787 in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:3574
#12 0x0000555555b6bdf4 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "select * from (select emp_id from emp for system_time all union select emp_id from emp ) as s", length=93, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902

@midenok
Copy link

midenok commented Sep 14, 2017

select * from (select emp_id from emp for system_time all union select emp_id from emp ) as s;

1. union prepared

#0  st_select_lex_unit::prepare (this=0x7fff8c011608, thd_arg=0x7fff8c000b00, sel_result=0x7fff8c014320, additional_options=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:826
#1  0x0000555555b26a09 in mysql_derived_prepare (thd=0x7fff8c000b00, lex=0x7fff8c004620, derived=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:852
#2  0x0000555555b251fb in mysql_handle_single_derived (lex=0x7fff8c004620, derived=0x7fff8c013498, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:197
#3  0x0000555555c76b13 in TABLE_LIST::handle_derived (this=0x7fff8c013498, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/table.cc:7931
#4  0x0000555555b477bd in st_select_lex::handle_derived (this=0x7fff8c004e48, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:4008
#5  0x0000555555ba04a3 in JOIN::prepare (this=0x7fff8c013bc0, tables_init=0x7fff8c013498, wild_num=1, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fff8c004e48, unit_arg=0x7fff8c0046e8) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:1070
#6  0x0000555555bab2db in mysql_select (thd=0x7fff8c000b00, tables=0x7fff8c013498, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff8c013ba0, unit=0x7fff8c0046e8, select_lex=0x7fff8c004e48) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:4055
#7  0x0000555555b9d7a6 in handle_select (thd=0x7fff8c000b00, lex=0x7fff8c004620, result=0x7fff8c013ba0, setup_tables_done_option=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:363
#8  0x0000555555b68ab3 in execute_sqlcom_select (thd=0x7fff8c000b00, all_tables=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6455
#9  0x0000555555b60787 in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:3574
#10 0x0000555555b6bdf4 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "select * from (select emp_id from emp for system_time all union select emp_id from emp ) as s", length=93, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902
(gdb) p sl
$3 = (SELECT_LEX *) 0x7fff8c011220

2. TABLE_SHARE inited

#0  init_tmp_table_share (thd=0x7fff8c000b00, share=0x7fff8c140008, key=0x5555566bd934 "", key_length=0, table_name=0x7fff8c1408a8 "/tmp/#sql_4c41_0", path=0x7fff8c1408a8 "/tmp/#sql_4c41_0") at /home/midenok/src/mariadb/midenok/src/sql/table.cc:381
#1  0x0000555555bcc038 in create_tmp_table (thd=0x7fff8c000b00, param=0x7fff8c014440, fields=..., group=0x0, distinct=true, save_sum_fields=true, select_options=2416188160, rows_limit=18446744073709551615, table_alias=0x5555566cebd0 "", do_not_open=false, keep_row_order=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:16832
#2  0x0000555555c4a214 in select_unit::create_result_table (this=0x7fff8c014408, thd_arg=0x7fff8c000b00, column_types=0x7fff8c011cd0, is_union_distinct=true, options=2416188160, alias=0x5555566cebd0 "", bit_fields_as_long=false, create_table=true, keep_row_order=false, hidden=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:374
#3  0x0000555555c4c2fe in st_select_lex_unit::prepare (this=0x7fff8c011608, thd_arg=0x7fff8c000b00, sel_result=0x7fff8c014320, additional_options=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_union.cc:992
#4  0x0000555555b26a09 in mysql_derived_prepare (thd=0x7fff8c000b00, lex=0x7fff8c004620, derived=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:852
#5  0x0000555555b251fb in mysql_handle_single_derived (lex=0x7fff8c004620, derived=0x7fff8c013498, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_derived.cc:197
#6  0x0000555555c76b13 in TABLE_LIST::handle_derived (this=0x7fff8c013498, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/table.cc:7931
#7  0x0000555555b477bd in st_select_lex::handle_derived (this=0x7fff8c004e48, lex=0x7fff8c004620, phases=2) at /home/midenok/src/mariadb/midenok/src/sql/sql_lex.cc:4008
#8  0x0000555555ba04a3 in JOIN::prepare (this=0x7fff8c013bc0, tables_init=0x7fff8c013498, wild_num=1, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fff8c004e48, unit_arg=0x7fff8c0046e8) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:1070
#9  0x0000555555bab2db in mysql_select (thd=0x7fff8c000b00, tables=0x7fff8c013498, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff8c013ba0, unit=0x7fff8c0046e8, select_lex=0x7fff8c004e48) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:4055
#10 0x0000555555b9d7a6 in handle_select (thd=0x7fff8c000b00, lex=0x7fff8c004620, result=0x7fff8c013ba0, setup_tables_done_option=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:363
#11 0x0000555555b68ab3 in execute_sqlcom_select (thd=0x7fff8c000b00, all_tables=0x7fff8c013498) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6455
#12 0x0000555555b60787 in mysql_execute_command (thd=0x7fff8c000b00) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:3574
#13 0x0000555555b6bdf4 in mysql_parse (thd=0x7fff8c000b00, rawbuf=0x7fff8c010fe8 "select * from (select emp_id from emp for system_time all union select emp_id from emp ) as s", length=93, parser_state=0x7fffe571b6b0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7902

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants