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

Assertion `has_rand == static_cast<bool>(un->uncacheable & 2)' failed in st_select_lex::optimize_unflattened_subqueries

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 12.2
    • 12.2
    • Parser

    Description

      SELECT (WITH cte AS (SELECT ST_GeomFromText('POLYGON((1 1,2 2,1 1))')) SELECT * FROM cte);
      

      12.2 a0bdb3b7d081697a30be5a4714c0f3e4084e1dda

      mariadbd: /data/bld/12.2-asan-ubsan/sql/sql_lex.cc:5180: bool st_select_lex::optimize_unflattened_subqueries(bool): Assertion `has_rand == static_cast<bool>(un->uncacheable & 2)' failed.
      251114 23:09:41 [ERROR] /share8t/bld/12.2-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #10 0x00007ff961c53eb2 in __GI___assert_fail (assertion=0x55ddb7181480 "has_rand == static_cast<bool>(un->uncacheable & 2)", file=0x55ddb71af2b8 "/data/bld/12.2-asan-ubsan/sql/sql_lex.cc", line=5180, function=0x55ddb7181420 "bool st_select_lex::optimize_unflattened_subqueries(bool)") at ./assert/assert.c:101
      #11 0x000055ddb337eeda in st_select_lex::optimize_unflattened_subqueries (this=this@entry=0x62d0000f0718, const_only=const_only@entry=false) at /data/bld/12.2-asan-ubsan/sql/sql_lex.cc:5180
      #12 0x000055ddb3f0540f in JOIN::optimize_unflattened_subqueries (this=this@entry=0x62d0000f4170) at /data/bld/12.2-asan-ubsan/sql/opt_subselect.cc:5913
      #13 0x000055ddb3771b94 in JOIN::optimize_stage2 (this=this@entry=0x62d0000f4170) at /data/bld/12.2-asan-ubsan/sql/sql_select.cc:3641
      #14 0x000055ddb3794b55 in JOIN::optimize_inner (this=this@entry=0x62d0000f4170) at /data/bld/12.2-asan-ubsan/sql/sql_select.cc:2798
      #15 0x000055ddb3795805 in JOIN::optimize (this=this@entry=0x62d0000f4170) at /data/bld/12.2-asan-ubsan/sql/sql_select.cc:2025
      #16 0x000055ddb3796a23 in mysql_select (thd=thd@entry=0x62c0000c0218, tables=<optimized out>, fields=..., conds=conds@entry=0x0, og_num=og_num@entry=0, order=order@entry=0x0, group=<optimized out>, having=<optimized out>, proc_param=<optimized out>, select_options=<optimized out>, result=<optimized out>, unit=<optimized out>, select_lex=<optimized out>) at /data/bld/12.2-asan-ubsan/sql/sql_select.cc:5436
      #17 0x000055ddb3797f02 in handle_select (thd=thd@entry=0x62c0000c0218, lex=lex@entry=0x62c0000c4758, result=result@entry=0x62d0000f4140, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/bld/12.2-asan-ubsan/sql/sql_select.cc:636
      #18 0x000055ddb34148a5 in execute_sqlcom_select (thd=thd@entry=0x62c0000c0218, all_tables=<optimized out>) at /data/bld/12.2-asan-ubsan/sql/sql_parse.cc:6171
      #19 0x000055ddb3454996 in mysql_execute_command (thd=thd@entry=0x62c0000c0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/12.2-asan-ubsan/sql/sql_parse.cc:3951
      #20 0x000055ddb347337c in mysql_parse (thd=thd@entry=0x62c0000c0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7ff955cc0a10) at /data/bld/12.2-asan-ubsan/sql/sql_parse.cc:7888
      #21 0x000055ddb347c465 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0000c0218, packet=packet@entry=0x6290002b2219 "SELECT (WITH cte AS (SELECT ST_GeomFromText('POLYGON((1 1,2 2,1 1))')) SELECT * FROM cte)", packet_length=packet_length@entry=89, blocking=blocking@entry=true) at /data/bld/12.2-asan-ubsan/sql/sql_parse.cc:1878
      #22 0x000055ddb3489351 in do_command (thd=thd@entry=0x62c0000c0218, blocking=blocking@entry=true) at /data/bld/12.2-asan-ubsan/sql/sql_parse.cc:1417
      #23 0x000055ddb3cde8da in do_handle_one_connection (connect=<optimized out>, connect@entry=0x6080000082b8, put_in_cache=put_in_cache@entry=true) at /data/bld/12.2-asan-ubsan/sql/sql_connect.cc:1503
      #24 0x000055ddb3cdfa43 in handle_one_connection (arg=0x6080000082b8) at /data/bld/12.2-asan-ubsan/sql/sql_connect.cc:1415
      #25 0x000055ddb5918763 in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/12.2-asan-ubsan/storage/perfschema/pfs.cc:2198
      #26 0x00007ff961ca81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #27 0x00007ff961d2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      No obvious immediate problem on a non-debug build.

      The failure started happening after this commit in 12.2:

      commit 101346c3dc174177faf5df109611bb4cb03efab5
      Author: Dave Gosselin
      Date:   Sat Oct 18 03:48:08 2025 -0400
       
          MDEV-37905: UNCACHEABLE_RAND inconsistently set on unions
      

      Attachments

        Issue Links

          Activity

            People

              Gosselin Dave Gosselin
              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.