Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14791

Crash with order by expression containing window functions

    Details

      Description

      CREATE TABLE t1 (b1 BIT, b2 BIT, b3 BIT, b4 BIT , b5 BIT, b6 BIT);
      INSERT INTO t1 VALUES (1,0,0,1,0,1),(0,1,0,0,1,0);
       
      SELECT b1
      from t1
      order by row_number() over (ORDER BY b6) + 1;
       
      # Cleanup
      DROP TABLE t1;
      

      #0  0x0000555555a5124a in Field::set_notnull (this=0x0, row_offset=0)
          at /home/vicentiu/Workspace/MariaDB/sql/field.h:1137
      #1  0x0000555555d9cfb5 in Item::save_in_field (this=0x7fffd4013348, field=0x0, no_conversions=true)
          at /home/vicentiu/Workspace/MariaDB/sql/item.cc:6441
      #2  0x0000555555ccba48 in save_window_function_values (window_functions=..., tbl=0x7fffd402d168, 
          rowid_buf=0x7fffd4006c50 "P7\003\324\377\177") at /home/vicentiu/Workspace/MariaDB/sql/sql_window.cc:2517
      #3  0x0000555555ccbe7f in compute_window_func (thd=0x7fffd4000d60, window_functions=..., cursor_managers=..., 
          tbl=0x7fffd402d168, filesort_result=0x7fffd404d0e0) at /home/vicentiu/Workspace/MariaDB/sql/sql_window.cc:2636
      #4  0x0000555555ccc238 in Window_func_runner::exec (this=0x7fffd4015be0, thd=0x7fffd4000d60, tbl=0x7fffd402d168, 
          filesort_result=0x7fffd404d0e0) at /home/vicentiu/Workspace/MariaDB/sql/sql_window.cc:2742
      #5  0x0000555555ccc351 in Window_funcs_sort::exec (this=0x7fffd4015bd8, join=0x7fffd40136d0)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_window.cc:2767
      #6  0x0000555555ccc817 in Window_funcs_computation::exec (this=0x7fffd4015bb8, join=0x7fffd40136d0)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_window.cc:2886
      #7  0x0000555555b8c8e0 in AGGR_OP::end_send (this=0x7fffd4015860)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:26530
      #8  0x0000555555b77b65 in sub_select_postjoin_aggr (join=0x7fffd40136d0, join_tab=0x7fffd4014b38, end_of_records=true)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:18369
      #9  0x0000555555b77e94 in sub_select (join=0x7fffd40136d0, join_tab=0x7fffd4014788, end_of_records=true)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:18605
      #10 0x0000555555b7769d in do_select (join=0x7fffd40136d0, procedure=0x0)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:18200
      #11 0x0000555555b5226a in JOIN::exec_inner (this=0x7fffd40136d0)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:3530
      #12 0x0000555555b51718 in JOIN::exec (this=0x7fffd40136d0) at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:3325
      #13 0x0000555555b528dc in mysql_select (thd=0x7fffd4000d60, tables=0x7fffd4012a20, wild_num=0, fields=..., conds=0x0, 
          og_num=1, order=0x7fffd4013590, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, 
          result=0x7fffd40136b0, unit=0x7fffd4004900, select_lex=0x7fffd4005038)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:3725
      #14 0x0000555555b47110 in handle_select (thd=0x7fffd4000d60, lex=0x7fffd4004838, result=0x7fffd40136b0, 
          setup_tables_done_option=0) at /home/vicentiu/Workspace/MariaDB/sql/sql_select.cc:361
      #15 0x0000555555b13221 in execute_sqlcom_select (thd=0x7fffd4000d60, all_tables=0x7fffd4012a20)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:6459
      #16 0x0000555555b08ee9 in mysql_execute_command (thd=0x7fffd4000d60)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:3463
      #17 0x0000555555b16bd1 in mysql_parse (thd=0x7fffd4000d60, 
          rawbuf=0x7fffd40127e8 "SELECT b1\nfrom t1\norder by row_number() over (ORDER BY b6) + 1", length=62, 
          parser_state=0x7fffeb582170, is_com_multi=false, is_next_command=false)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:7900
      #18 0x0000555555b04819 in dispatch_command (command=COM_QUERY, thd=0x7fffd4000d60, packet=0x7fffd4008ba1 "", 
          packet_length=62, is_com_multi=false, is_next_command=false)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:1804
      #19 0x0000555555b031b2 in do_command (thd=0x7fffd4000d60) at /home/vicentiu/Workspace/MariaDB/sql/sql_parse.cc:1359
      #20 0x0000555555c4fbd8 in do_handle_one_connection (connect=0x555557bea3f0)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_connect.cc:1335
      #21 0x0000555555c4f958 in handle_one_connection (arg=0x555557bea3f0)
          at /home/vicentiu/Workspace/MariaDB/sql/sql_connect.cc:1241
      #22 0x000055555648a035 in pfs_spawn_thread (arg=0x555557bf2e60)
          at /home/vicentiu/Workspace/MariaDB/storage/perfschema/pfs.cc:1863
      #23 0x00007ffff7bc108a in start_thread () from /usr/lib/libpthread.so.0
      #24 0x00007ffff5ac542f in clone () from /usr/lib/libc.so.6
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                varun Varun Gupta
                Reporter:
                cvicentiu Vicențiu Ciorbaru
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: