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

Assertion `entry->pos_in_table_list->table == entry' failed upon PREPARE with UNION in ORACLE mode

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(2); # Optional, fails either way
      CREATE VIEW v1 AS SELECT * FROM t;
      CREATE VIEW v2 AS (SELECT * FROM v1) UNION (SELECT * FROM v1);
       
      SET sql_mode = ORACLE;
      --error ER_NON_UPDATABLE_TABLE
      PREPARE stmt FROM 'DELETE FROM v2';
       
      DROP VIEW v2;
      DROP VIEW v1;
      DROP TABLE t;
      

      10.11 3d2ae78f843ed1b5ba715439014aa7bbd1eceaa3

      mariadbd: /data/bld/10.11-asan-ubsan/sql/sql_select.cc:22360: void free_tmp_table(THD*, TABLE*): Assertion `entry->pos_in_table_list->table == entry' failed.
      260506 23:06:12 [ERROR] /share8t/bld/10.11-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #10 0x00007fe7ac853eb2 in __GI___assert_fail (assertion=0x563d9c57bf40 "entry->pos_in_table_list->table == entry", file=0x563d9c5731e0 "/data/bld/10.11-asan-ubsan/sql/sql_select.cc", line=22360, function=0x563d9c57bfa0 "void free_tmp_table(THD*, TABLE*)") at ./assert/assert.c:101
      #11 0x0000563d98e61ac1 in free_tmp_table (thd=thd@entry=0x62c0000b0218, entry=entry@entry=0x62d0002bc438) at /data/bld/10.11-asan-ubsan/sql/sql_select.cc:22360
      #12 0x0000563d988b2bde in close_thread_tables (thd=thd@entry=0x62c0000b0218) at /data/bld/10.11-asan-ubsan/sql/sql_base.cc:917
      #13 0x0000563d988b3675 in close_thread_tables_for_query (thd=0x62c0000b0218) at /data/bld/10.11-asan-ubsan/sql/sql_base.cc:815
      #14 0x0000563d98d58e91 in Prepared_statement::prepare (this=this@entry=0x61900005be98, packet=<optimized out>, packet_len=<optimized out>) at /data/bld/10.11-asan-ubsan/sql/sql_prepare.cc:4511
      #15 0x0000563d98d65998 in mysql_sql_stmt_prepare (thd=thd@entry=0x62c0000b0218) at /data/bld/10.11-asan-ubsan/sql/sql_prepare.cc:3072
      #16 0x0000563d98c5c1a9 in mysql_execute_command (thd=thd@entry=0x62c0000b0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:4053
      #17 0x0000563d98c7e1b8 in mysql_parse (thd=thd@entry=0x62c0000b0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fe7a1d3cab0) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:8223
      #18 0x0000563d98c8752a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0000b0218, packet=packet@entry=0x62900024e219 "PREPARE stmt FROM 'DELETE FROM v2'", packet_length=packet_length@entry=34, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1924
      #19 0x0000563d98c93bd7 in do_command (thd=thd@entry=0x62c0000b0218, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1434
      #20 0x0000563d994897fe in do_handle_one_connection (connect=<optimized out>, connect@entry=0x6080000039b8, put_in_cache=put_in_cache@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1475
      #21 0x0000563d9948a95b in handle_one_connection (arg=0x6080000039b8) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1387
      #22 0x0000563d9adc12b1 in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/10.11-asan-ubsan/storage/perfschema/pfs.cc:2201
      #23 0x00007fe7ac8a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #24 0x00007fe7ac92885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening after this commit in 10.11.16:

      commit 10643cffe98a42ee28a9f16b70ad7dff90563a03
      Author: Aleksey Midenkov
      Date:   Tue Dec 23 13:42:45 2025 +0300
       
          MDEV-37325 Incorrect results for INTERSECT ALL in ORACLE mode
      

      No obvious immediate problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.