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

Assertion `m_sp == __null' failed in Item_func_sp::init_result_field upon 2nd execution of SP

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a INT) ENGINE=MyISAM;
      CREATE FUNCTION f(x INT) RETURNS INT RETURN 8;
      CREATE VIEW v AS SELECT f(a) AS b FROM t;
      CREATE PROCEDURE p() SELECT COUNT(b) FROM v;
      CALL p();
      DROP TABLE t;
      CREATE TABLE t (c INT);
      CALL p();
       
      # Cleanup
      DROP PROCEDURE p;
      DROP FUNCTION f;
      DROP VIEW v;
      DROP TABLE t;
      

      5.5 3eb2a265eac5

      mysqld: /data/src/5.5/sql/item_func.cc:6726: bool Item_func_sp::init_result_field(THD*): Assertion `m_sp == __null' failed.
      180412  0:42:59 [ERROR] mysqld got signal 6 ;
       
      #0  do_sigwait (set=<optimized out>, set@entry=0x7fbfe4fd1de0, sig=sig@entry=0x7fbfe4fd1e78) at ../sysdeps/unix/sysv/linux/sigwait.c:64
      #1  0x00007fbfe4bc4ced in __sigwait (set=0x7fbfe4fd1de0, sig=0x7fbfe4fd1e78) at ../sysdeps/unix/sysv/linux/sigwait.c:96
      #11 0x00000000006cefc5 in Field_iterator_view::create_item (this=0x7fbfe4f86340, thd=0x7fbfdf264060) at /data/src/5.5/sql/table.cc:5205
      #12 0x00000000005a8e30 in find_field_in_view (thd=0x7fbfdf264060, table_list=0x7fbfde180078, name=0x7fbfde1a2cf0 "b", length=1, item_name=0x7fbfde1a2cf0 "b", ref=0x7fbfde1a2ef8, register_tree_change=true) at /data/src/5.5/sql/sql_base.cc:6310
      #13 0x00000000005a9ce7 in find_field_in_table_ref (thd=0x7fbfdf264060, table_list=0x7fbfde180078, name=0x7fbfde1a2cf0 "b", length=1, item_name=0x7fbfde1a2cf0 "b", db_name=0x0, table_name=0x0, ref=0x7fbfde1a2ef8, check_privileges=true, allow_rowid=true, cached_field_index_ptr=0x7fbfde1a2dc4, register_tree_change=true, actual_table=0x7fbfe4f86798) at /data/src/5.5/sql/sql_base.cc:6670
      #14 0x00000000005aa783 in find_field_in_tables (thd=0x7fbfdf264060, item=0x7fbfde1a2d00, first_table=0x7fbfde180078, last_table=0x0, ref=0x7fbfde1a2ef8, report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true) at /data/src/5.5/sql/sql_base.cc:6977
      #15 0x00000000007ca380 in Item_field::fix_fields (this=0x7fbfde1a2d00, thd=0x7fbfdf264060, reference=0x7fbfde1a2ef8) at /data/src/5.5/sql/item.cc:5255
      #16 0x0000000000855a2d in Item_sum_num::fix_fields (this=0x7fbfde1a2e08, thd=0x7fbfdf264060, ref=0x7fbfde1a2f40) at /data/src/5.5/sql/item_sum.cc:1163
      #17 0x00000000005ad133 in setup_fields (thd=0x7fbfdf264060, ref_pointer_array=0x7fbfde1b0ae8, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fbfde1aa500, pre_fix=0x7fbfde1a2250, allow_sum_func=true) at /data/src/5.5/sql/sql_base.cc:8189
      #18 0x000000000062f1ef in JOIN::prepare (this=0x7fbfde1aa1b0, rref_pointer_array=0x7fbfde1a23c0, tables_init=0x7fbfde180078, wild_num=0, 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=0x7fbfde1a2120, unit_arg=0x7fbfde1a1a40) at /data/src/5.5/sql/sql_select.cc:733
      #19 0x0000000000637b88 in mysql_select (thd=0x7fbfdf264060, rref_pointer_array=0x7fbfde1a23c0, tables=0x7fbfde180078, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147749632, result=0x7fbfde1aa190, unit=0x7fbfde1a1a40, select_lex=0x7fbfde1a2120) at /data/src/5.5/sql/sql_select.cc:3098
      #20 0x000000000062e3ea in handle_select (thd=0x7fbfdf264060, lex=0x7fbfde1a1990, result=0x7fbfde1aa190, setup_tables_done_option=0) at /data/src/5.5/sql/sql_select.cc:323
      #21 0x000000000060786e in execute_sqlcom_select (thd=0x7fbfdf264060, all_tables=0x7fbfde180078) at /data/src/5.5/sql/sql_parse.cc:4678
      #22 0x0000000000600bef in mysql_execute_command (thd=0x7fbfdf264060) at /data/src/5.5/sql/sql_parse.cc:2224
      #23 0x00000000008e116c in sp_instr_stmt::exec_core (this=0x7fbfde1a2fb8, thd=0x7fbfdf264060, nextp=0x7fbfe4f87c28) at /data/src/5.5/sql/sp_head.cc:3220
      #24 0x00000000008e0913 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7fbfde1a2ff8, thd=0x7fbfdf264060, nextp=0x7fbfe4f87c28, open_tables=false, instr=0x7fbfde1a2fb8) at /data/src/5.5/sql/sp_head.cc:2998
      #25 0x00000000008e0e94 in sp_instr_stmt::execute (this=0x7fbfde1a2fb8, thd=0x7fbfdf264060, nextp=0x7fbfe4f87c28) at /data/src/5.5/sql/sp_head.cc:3144
      #26 0x00000000008dccfd in sp_head::execute (this=0x7fbfde1a1078, thd=0x7fbfdf264060, merge_da_on_success=true) at /data/src/5.5/sql/sp_head.cc:1431
      #27 0x00000000008dea63 in sp_head::execute_procedure (this=0x7fbfde1a1078, thd=0x7fbfdf264060, args=0x7fbfdf268020) at /data/src/5.5/sql/sp_head.cc:2197
      #28 0x0000000000605ecb in mysql_execute_command (thd=0x7fbfdf264060) at /data/src/5.5/sql/sql_parse.cc:4115
      #29 0x000000000060a43a in mysql_parse (thd=0x7fbfdf264060, rawbuf=0x7fbfde148078 "CALL p()", length=8, parser_state=0x7fbfe4f88640) at /data/src/5.5/sql/sql_parse.cc:5923
      #30 0x00000000005fe14f in dispatch_command (command=COM_QUERY, thd=0x7fbfdf264060, packet=0x7fbfe2f5b061 "CALL p()", packet_length=8) at /data/src/5.5/sql/sql_parse.cc:1066
      #31 0x00000000005fd341 in do_command (thd=0x7fbfdf264060) at /data/src/5.5/sql/sql_parse.cc:793
      #32 0x000000000070049d in do_handle_one_connection (thd_arg=0x7fbfdf264060) at /data/src/5.5/sql/sql_connect.cc:1268
      #33 0x000000000070022a in handle_one_connection (arg=0x7fbfdf264060) at /data/src/5.5/sql/sql_connect.cc:1184
      #34 0x0000000000a0e429 in pfs_spawn_thread (arg=0x7fbfdff76fc0) at /data/src/5.5/storage/perfschema/pfs.cc:1015
      #35 0x00007fbfe4bbb494 in start_thread (arg=0x7fbfe4f89700) at pthread_create.c:333
      #36 0x00007fbfe35d193f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Reproducible on all of MariaDB 5.5-10.3 and MySQL 5.5. Not reproducible on MySQL 5.6, 5.7.

      Non-debug build returns

      mysqltest: At line 8: query 'CALL p()' failed: 1356: View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
      

      which I believe is expected.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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