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

server crashed, when using ORDER BY with window function and UNION

    XMLWordPrintable

Details

    Description

      testcase

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(1),(1),(1),(1),(2),(2),(2),(2),(2),(2);
      SELECT 1 UNION SELECT a FROM t ORDER BY (row_number() over ());
      

      Thread 1 (Thread 0x7f7755e09700 (LWP 7074)):
      #0  __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
      #1  0x0000560addd0c403 in my_write_core (sig=11) at /home/alice/git/10.2/mysys/stacktrace.c:477
      #2  0x0000560add59c6f1 in handle_fatal_signal (sig=11) at /home/alice/git/10.2/sql/signal_handler.cc:305
      #3  <signal handler called>
      #4  0x0000560add4b2d8c in Exec_time_tracker::get_loops (this=0x8) at /home/alice/git/10.2/sql/sql_analyze_stmt.h:74
      #5  0x0000560add59b9c4 in Filesort_tracker::report_use (this=0x0, r_limit_arg=18446744073709551615) at /home/alice/git/10.2/sql/sql_analyze_stmt.h:191
      #6  0x0000560add59612e in filesort (thd=0x7f7744000a98, table=0x7f77441675b0, filesort=0x7f774406f7e0, tracker=0x0, join=0x7f77441842b0, first_table_bit=1) at /home/alice/git/10.2/sql/filesort.cc:211
      #7  0x0000560add3a2afb in create_sort_index (thd=0x7f7744000a98, join=0x7f77441842b0, tab=0x7f7744166e20, fsort=0x7f774406f7e0) at /home/alice/git/10.2/sql/sql_select.cc:21790
      #8  0x0000560add4f1fac in Window_funcs_sort::exec (this=0x7f77441163f0, join=0x7f77441842b0) at /home/alice/git/10.2/sql/sql_window.cc:2761
      #9  0x0000560add4f24af in Window_funcs_computation::exec (this=0x7f7744067290, join=0x7f77441842b0) at /home/alice/git/10.2/sql/sql_window.cc:2886
      #10 0x0000560add3afaaa in AGGR_OP::end_send (this=0x7f7744146f30) at /home/alice/git/10.2/sql/sql_select.cc:26540
      #11 0x0000560add39ac26 in sub_select_postjoin_aggr (join=0x7f77441842b0, join_tab=0x7f7744166e20, end_of_records=true) at /home/alice/git/10.2/sql/sql_select.cc:18379
      #12 0x0000560add39af4a in sub_select (join=0x7f77441842b0, join_tab=0x7f7744166a70, end_of_records=true) at /home/alice/git/10.2/sql/sql_select.cc:18615
      #13 0x0000560add39a75b in do_select (join=0x7f77441842b0, procedure=0x0) at /home/alice/git/10.2/sql/sql_select.cc:18210
      #14 0x0000560add375185 in JOIN::exec_inner (this=0x7f77441842b0) at /home/alice/git/10.2/sql/sql_select.cc:3540
      #15 0x0000560add374626 in JOIN::exec (this=0x7f77441842b0) at /home/alice/git/10.2/sql/sql_select.cc:3335
      #16 0x0000560add3757f6 in mysql_select (thd=0x7f7744000a98, tables=0x7f7744004688, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7f77441443c0, group=0x0, having=0x0, proc_param=0x0, select_options=268435456, result=0x7f774417bef0, unit=0x7f7744004638, select_lex=0x7f7744147c20) at /home/alice/git/10.2/sql/sql_select.cc:3735
      #17 0x0000560add412e37 in st_select_lex_unit::exec (this=0x7f7744004638) at /home/alice/git/10.2/sql/sql_union.cc:1129
      #18 0x0000560add40f100 in mysql_union (thd=0x7f7744000a98, lex=0x7f7744004570, result=0x7f774417bef0, unit=0x7f7744004638, setup_tables_done_option=0) at /home/alice/git/10.2/sql/sql_union.cc:41
      #19 0x0000560add369e45 in handle_select (thd=0x7f7744000a98, lex=0x7f7744004570, result=0x7f774417bef0, setup_tables_done_option=0) at /home/alice/git/10.2/sql/sql_select.cc:351
      #20 0x0000560add335e82 in execute_sqlcom_select (thd=0x7f7744000a98, all_tables=0x7f774417dca0) at /home/alice/git/10.2/sql/sql_parse.cc:6456
      #21 0x0000560add32bc00 in mysql_execute_command (thd=0x7f7744000a98) at /home/alice/git/10.2/sql/sql_parse.cc:3467
      #22 0x0000560add33981d in mysql_parse (thd=0x7f7744000a98, rawbuf=0x7f7744181790 "SELECT 1 UNION SELECT a FROM t ORDER BY (row_number() over ())", length=62, parser_state=0x7f7755e081f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:7897
      #23 0x0000560add32749f in dispatch_command (command=COM_QUERY, thd=0x7f7744000a98, packet=0x7f7744007fe9 "", packet_length=62, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:1806
      #24 0x0000560add325dfb in do_command (thd=0x7f7744000a98) at /home/alice/git/10.2/sql/sql_parse.cc:1360
      #25 0x0000560add47401f in do_handle_one_connection (connect=0x560ae0bffd48) at /home/alice/git/10.2/sql/sql_connect.cc:1335
      #26 0x0000560add473d9f in handle_one_connection (arg=0x560ae0bffd48) at /home/alice/git/10.2/sql/sql_connect.cc:1241
      #27 0x0000560add7d1bc4 in pfs_spawn_thread (arg=0x560ae0b5f908) at /home/alice/git/10.2/storage/perfschema/pfs.cc:1862
      #28 0x00007f775c7736ba in start_thread (arg=0x7f7755e09700) at pthread_create.c:333
      #29 0x00007f775bc0841d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.