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

Assertion `used_tables_cache == 0' failed in Item_func::fix_fields

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a INT) ENGINE=InnoDB;
      CREATE ALGORITHM=MERGE VIEW v AS SELECT 1*a AS a FROM t;
      DROP TABLE t;
      CREATE TABLE t (a GEOMETRY) ENGINE=InnoDB;
      INSERT INTO v (a) VALUES (0);
      

      Leads to:

      10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

      mysqld: /test/10.6_dbg/sql/item_func.cc:329: virtual bool Item_func::fix_fields(THD*, Item**): Assertion `used_tables_cache == 0' failed.
      

      10.6.1 f8665314d4ba190679001b81bb7d9fd7a38fc0f6 (Debug)

      Core was generated by `/test/MD100521-mariadb-10.6.1-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x1534f00a9700 (LWP 995248))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00001534f910d859 in __GI_abort () at abort.c:79
      #2  0x00001534f910d729 in __assert_fail_base (fmt=0x1534f92a3588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55a2af46da5e "used_tables_cache == 0", file=0x55a2af46df70 "/test/10.6_dbg/sql/item_func.cc", line=329, function=<optimized out>) at assert.c:92
      #3  0x00001534f911ef36 in __GI___assert_fail (assertion=assertion@entry=0x55a2af46da5e "used_tables_cache == 0", file=file@entry=0x55a2af46df70 "/test/10.6_dbg/sql/item_func.cc", line=line@entry=329, function=function@entry=0x55a2af46e2f0 "virtual bool Item_func::fix_fields(THD*, Item**)") at assert.c:101
      #4  0x000055a2ae98deec in Item_func::fix_fields (this=0x1534a4017c08, thd=0x1534a4000db8, ref=<optimized out>) at /test/10.6_dbg/sql/item_func.cc:329
      #5  0x000055a2ae741150 in create_view_field (thd=thd@entry=0x1534a4000db8, view=0x1534a40140c0, field_ref=0x1534a4019408, name=0x1534a4019410) at /test/10.6_dbg/sql/table.cc:6828
      #6  0x000055a2ae74147d in Field_iterator_view::create_item (this=this@entry=0x1534f00a73a0, thd=thd@entry=0x1534a4000db8) at /test/10.6_dbg/sql/table.cc:6803
      #7  0x000055a2ae5a3a22 in find_field_in_view (register_tree_change=true, ref=0x1534a40148f0, item_name=<optimized out>, length=1, name=0x1534a40147a0 "a", table_list=0x1534a40140c0, thd=0x1534a4000db8) at /test/10.6_dbg/sql/sql_base.cc:5839
      #8  find_field_in_table_ref (thd=thd@entry=0x1534a4000db8, table_list=table_list@entry=0x1534a40140c0, name=name@entry=0x1534a40147a0 "a", length=length@entry=1, item_name=<optimized out>, db_name=<optimized out>, db_name@entry=0x0, table_name=0x0, ignored_tables=0x0, ref=0x1534a40148f0, check_privileges=true, allow_rowid=true, cached_field_index_ptr=0x1534a40148a4, register_tree_change=true, actual_table=0x1534f00a74e8) at /test/10.6_dbg/sql/sql_base.cc:6178
      #9  0x000055a2ae5a4dcf in find_field_in_tables (thd=thd@entry=0x1534a4000db8, item=item@entry=0x1534a40147a8, first_table=<optimized out>, last_table=0x0, ignored_tables=0x0, ref=ref@entry=0x1534a40148f0, report_error=REPORT_ALL_ERRORS, check_privileges=true, register_tree_change=true) at /test/10.6_dbg/sql/sql_base.cc:6496
      #10 0x000055a2ae934e9c in Item_field::fix_outer_field (this=this@entry=0x1534a40147a8, thd=thd@entry=0x1534a4000db8, from_field=from_field@entry=0x1534f00a78b0, reference=reference@entry=0x1534a40148f0) at /test/10.6_dbg/sql/item.cc:5688
      #11 0x000055a2ae93599c in Item_field::fix_fields (this=0x1534a40147a8, thd=0x1534a4000db8, reference=0x1534a40148f0) at /test/10.6_dbg/sql/item.cc:5946
      #12 0x000055a2ae5a58ba in Item::fix_fields_if_needed (ref=0x1534a40148f0, thd=0x1534a4000db8, this=0x1534a40147a8) at /test/10.6_dbg/sql/sql_list.h:199
      #13 Item::fix_fields_if_needed_for_scalar (ref=0x1534a40148f0, thd=0x1534a4000db8, this=0x1534a40147a8) at /test/10.6_dbg/sql/item.h:1002
      #14 setup_fields (thd=thd@entry=0x1534a4000db8, ref_pointer_array=<optimized out>, fields=@0x1534a4006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1534a40148e8, last = 0x1534a40148e8, elements = 1}, <No data fields>}, column_usage=column_usage@entry=MARK_COLUMNS_WRITE, sum_func_list=sum_func_list@entry=0x0, pre_fix=0x0, allow_sum_func=false) at /test/10.6_dbg/sql/sql_base.cc:7695
      #15 0x000055a2ae5df1a8 in check_insert_fields (thd=thd@entry=0x1534a4000db8, table_list=0x1534a40140c0, fields=@0x1534a4006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1534a40148e8, last = 0x1534a40148e8, elements = 1}, <No data fields>}, values=@0x1534a4014d90: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1534a4014e48, last = 0x1534a4014e48, elements = 1}, <No data fields>}, check_unique=check_unique@entry=false, fields_and_values_from_different_maps=fields_and_values_from_different_maps@entry=false, map=0x1534f00a7b68) at /test/10.6_dbg/sql/sql_array.h:38
      #16 0x000055a2ae5e0ec2 in mysql_prepare_insert (thd=thd@entry=0x1534a4000db8, table_list=table_list@entry=0x1534a40140c0, fields=@0x1534a4006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1534a40148e8, last = 0x1534a40148e8, elements = 1}, <No data fields>}, values=values@entry=0x1534a4014d90, update_fields=@0x1534a4006038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a2afc14480 <end_of_list>, last = 0x1534a4006038, elements = 0}, <No data fields>}, update_values=@0x1534a4006020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a2afc14480 <end_of_list>, last = 0x1534a4006020, elements = 0}, <No data fields>}, duplic=DUP_ERROR, where=0x1534f00a7cb8, select_insert=false) at /test/10.6_dbg/sql/sql_array.h:38
      #17 0x000055a2ae5ebe5b in mysql_insert (thd=thd@entry=0x1534a4000db8, table_list=0x1534a40140c0, fields=@0x1534a4006008: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1534a40148e8, last = 0x1534a40148e8, elements = 1}, <No data fields>}, values_list=@0x1534a4006050: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1534a4014e58, last = 0x1534a4014e58, elements = 1}, <No data fields>}, update_fields=@0x1534a4006038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a2afc14480 <end_of_list>, last = 0x1534a4006038, elements = 0}, <No data fields>}, update_values=@0x1534a4006020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55a2afc14480 <end_of_list>, last = 0x1534a4006020, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.6_dbg/sql/sql_insert.cc:768
      #18 0x000055a2ae634824 in mysql_execute_command (thd=thd@entry=0x1534a4000db8) at /test/10.6_dbg/sql/sql_parse.cc:4559
      #19 0x000055a2ae61f02b in mysql_parse (thd=thd@entry=0x1534a4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1534f00a8410) at /test/10.6_dbg/sql/sql_parse.cc:8018
      #20 0x000055a2ae62de5d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1534a4000db8, packet=packet@entry=0x1534a400b799 "INSERT INTO v (a) VALUES (0)", packet_length=packet_length@entry=28, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
      #21 0x000055a2ae631250 in do_command (thd=0x1534a4000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
      #22 0x000055a2ae78bdec in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55a2b2adb9e8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #23 0x000055a2ae78c3f1 in handle_one_connection (arg=arg@entry=0x55a2b2adb9e8) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #24 0x000055a2aec3ecee in pfs_spawn_thread (arg=0x55a2b29c52d8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #25 0x00001534f961b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #26 0x00001534f920a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.3.29 (dbg), 10.4.19 (dbg), 10.5.10 (dbg), 10.6.1 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.1 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              Roel Roel Van de Paar
              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.