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

Assertion `outer_context || !*from_field || *from_field == not_found_field' failed on 2nd execution of PS with subqueries

    XMLWordPrintable

Details

    Description

      Set to Minor as it's a debug assertion on old versions, not reproducible with the provided test case on 10.6+.
      Possibly related to MDEV-29071.

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(2);
       
      PREPARE stmt FROM "
        SELECT * FROM (
          SELECT t_joined.* FROM (
            SELECT t1.* FROM (
              t AS t1 JOIN t AS t2
            )
          ) AS t_joined
          WHERE t_joined.a IN (
            SELECT a FROM t WHERE a <> t_joined.a
          )
        ) sq";
       
      EXECUTE stmt;
      EXECUTE stmt;
       
      # Cleanup
      DROP TABLE t;
      

      10.4 956d6c4a

      mysqld: /data/src/10.4/sql/item.cc:5563: int Item_field::fix_outer_field(THD*, Field**, Item**): Assertion `outer_context || !*from_field || *from_field == not_found_field' failed.
      230603  1:43:55 [ERROR] mysqld got signal 6 ;
       
      #8  0x00007f5103f66395 in __assert_fail_base (fmt=0x7f51040daa70 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55c249908540 "outer_context || !*from_field || *from_field == not_found_field", file=file@entry=0x55c249903d00 "/data/src/10.4/sql/item.cc", line=line@entry=5563, function=function@entry=0x55c2499085a0 "int Item_field::fix_outer_field(THD*, Field**, Item**)") at ./assert/assert.c:92
      #9  0x00007f5103f74df2 in __GI___assert_fail (assertion=0x55c249908540 "outer_context || !*from_field || *from_field == not_found_field", file=0x55c249903d00 "/data/src/10.4/sql/item.cc", line=5563, function=0x55c2499085a0 "int Item_field::fix_outer_field(THD*, Field**, Item**)") at ./assert/assert.c:101
      #10 0x000055c247d25f8b in Item_field::fix_outer_field (this=0x629000249920, thd=0x62b00005b208, from_field=0x7f50fc1e4d00, reference=0x629000249ad0) at /data/src/10.4/sql/item.cc:5563
      #11 0x000055c247d2a127 in Item_field::fix_fields (this=0x629000249920, thd=0x62b00005b208, reference=0x629000249ad0) at /data/src/10.4/sql/item.cc:6013
      #12 0x000055c247279605 in Item::fix_fields_if_needed (this=0x629000249920, thd=0x62b00005b208, ref=0x629000249ad0) at /data/src/10.4/sql/item.h:966
      #13 0x000055c247e00835 in Item_func::fix_fields (this=0x629000249a38, thd=0x62b00005b208, ref=0x62b000062530) at /data/src/10.4/sql/item_func.cc:355
      #14 0x000055c247279605 in Item::fix_fields_if_needed (this=0x629000249a38, thd=0x62b00005b208, ref=0x62b000062530) at /data/src/10.4/sql/item.h:966
      #15 0x000055c24727963b in Item::fix_fields_if_needed_for_scalar (this=0x629000249a38, thd=0x62b00005b208, ref=0x62b000062530) at /data/src/10.4/sql/item.h:970
      #16 0x000055c2473acf13 in Item::fix_fields_if_needed_for_bool (this=0x629000249a38, thd=0x62b00005b208, ref=0x62b000062530) at /data/src/10.4/sql/item.h:974
      #17 0x000055c247d9e6f3 in Item_cond::fix_fields (this=0x62b0000623f0, thd=0x62b00005b208, ref=0x62b000062ab8) at /data/src/10.4/sql/item_cmpfunc.cc:4848
      #18 0x000055c247279605 in Item::fix_fields_if_needed (this=0x62b0000623f0, thd=0x62b00005b208, ref=0x62b000062ab8) at /data/src/10.4/sql/item.h:966
      #19 0x000055c24727963b in Item::fix_fields_if_needed_for_scalar (this=0x62b0000623f0, thd=0x62b00005b208, ref=0x62b000062ab8) at /data/src/10.4/sql/item.h:970
      #20 0x000055c2473acf13 in Item::fix_fields_if_needed_for_bool (this=0x62b0000623f0, thd=0x62b00005b208, ref=0x62b000062ab8) at /data/src/10.4/sql/item.h:974
      #21 0x000055c2473a442d in setup_conds (thd=0x62b00005b208, tables=0x62900024af58, leaves=..., conds=0x62b000062ab8) at /data/src/10.4/sql/sql_base.cc:8539
      #22 0x000055c2475b5d6a in setup_without_group (thd=0x62b00005b208, ref_pointer_array=..., tables=0x62900024af58, leaves=..., fields=..., all_fields=..., conds=0x62b000062ab8, order=0x0, group=0x0, win_specs=..., win_funcs=..., hidden_group_fields=0x62b000062997, reserved=0x62b00008e324) at /data/src/10.4/sql/sql_select.cc:745
      #23 0x000055c2475bd551 in JOIN::prepare (this=0x62b0000626b0, tables_init=0x62900024af58, wild_num=0, conds_init=0x62b0000623f0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x62b00008dff0, unit_arg=0x62b00008c2f8) at /data/src/10.4/sql/sql_select.cc:1334
      #24 0x000055c2475e2c86 in mysql_select (thd=0x62b00005b208, tables=0x62900024af58, wild_num=0, fields=..., conds=0x62b0000623f0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x62900024bed0, unit=0x62b00008c2f8, select_lex=0x62b00008dff0) at /data/src/10.4/sql/sql_select.cc:4789
      #25 0x000055c2475b3cf5 in handle_select (thd=0x62b00005b208, lex=0x62b00008c238, result=0x62900024bed0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:442
      #26 0x000055c24752385f in execute_sqlcom_select (thd=0x62b00005b208, all_tables=0x62900024af58) at /data/src/10.4/sql/sql_parse.cc:6473
      #27 0x000055c247510d74 in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:3976
      #28 0x000055c2475805db in Prepared_statement::execute (this=0x619000086688, expanded_query=0x7f50fc1e7b30, open_cursor=false) at /data/src/10.4/sql/sql_prepare.cc:5024
      #29 0x000055c24757bc1b in Prepared_statement::execute_loop (this=0x619000086688, expanded_query=0x7f50fc1e7b30, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.4/sql/sql_prepare.cc:4493
      #30 0x000055c247575a91 in mysql_sql_stmt_execute (thd=0x62b00005b208) at /data/src/10.4/sql/sql_prepare.cc:3577
      #31 0x000055c247510db9 in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:3992
      #32 0x000055c24752ca37 in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "EXECUTE stmt", length=12, parser_state=0x7f50fc1e9860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8008
      #33 0x000055c247502d7a in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x629000230209 "EXECUTE stmt", packet_length=12, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #34 0x000055c2474ff8f3 in do_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:1378
      #35 0x000055c2478fe89a in do_handle_one_connection (connect=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1420
      #36 0x000055c2478fe1b1 in handle_one_connection (arg=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1324
      #37 0x000055c24856ab84 in pfs_spawn_thread (arg=0x615000003508) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #38 0x00007f5103fc8fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #39 0x00007f51040495bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Reproducible on 10.4, 10.5 with at least MyISAM, InnoDB, Aria.

      Attachments

        Activity

          People

            shulga Dmitry Shulga
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.