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

default_storage_engine=DuckDB allows ENGINE=MyISAM/InnoDB table constructs to be honored whereas they should not be

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      Related to MDEV-40838, however this is another issue; an ENGINE= selector bug as explained inline below. Testcase is CLI and MTR compatible.

      SET sql_mode='';
      INSTALL SONAME 'ha_duckdb';
      SET SESSION default_storage_engine=DuckDB;
      CREATE TABLE t1 (c1 INT KEY,c2 DEC(1,0) NOT NULL,c3 SET('a','b','c','1'),c4 INT(1) UNSIGNED NOT NULL,KEY(c2)) ENGINE=MyISAM WITH SYSTEM VERSIONING;  # Allowed while it should not be. It gets confused on the ENGINE=. Does not work without SET SESSION default_storage_engine=DuckDB; nor when using ENGINE=DuckDB
      INSERT INTO t1 (c3) VALUES (1);
      CREATE TABLE t2 (c0 VARCHAR(1) BINARY, c1 FLOAT KEY,c2 FLOAT);
      WITH a AS (SELECT * FROM t1),b AS (SELECT * FROM t1),c AS (SELECT * FROM t2) SELECT * FROM a JOIN b ON a.c2=b.c2 LEFT JOIN c ON b.c2=c.c2;
      

      Leads to:

      CS 13.1.0 da18481158c81ca94689702073c3e04aad85a6a3 (Optimized, Clang 22.1.8-20260622) Build 18/08/2026

      Core was generated by `/test/MD180826-mariadb-13.1.0-linux-x86_64-opt/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1556938)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x00007403a704527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007403a70288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007403a74a5ff5 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
      #6  0x00007403a74bb0da in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
      #7  0x00007403a74a5a55 in std::terminate() ()
         from /lib/x86_64-linux-gnu/libstdc++.so.6
      #8  0x00007403a74bb391 in __cxa_throw ()
         from /lib/x86_64-linux-gnu/libstdc++.so.6
      #9  0x00006c027100f221 in float duckdb::Value::GetValueInternal<float>() const()
         from /test/MD180826-mariadb-13.1.0-linux-x86_64-opt/lib/plugin/ha_duckdb.so
      #10 0x00006c0270d03bf1 in store_duckdb_field_in_mysql_format (field=0x6c02783503f0, value=@0x7403785fd600: <incomplete type>, thd=<optimized out>)at /test/13.1_opt/storage/duckdb/convertor/duckdb_select.cc:145
      #11 0x00006c0270ca982e in ha_duckdb_select_handler::next_row (this=0x6c027834d160)at /test/13.1_opt/storage/duckdb/ha_duckdb_pushdown.cc:922
      #12 0x000060a89803a0ec in select_handler::execute (this=0x6c027834d160)at /test/13.1_opt/sql/select_handler.cc:172
      #13 0x000060a897fefb55 in JOIN::exec_inner (this=this@entry=0x6c02783291a0)at /test/13.1_opt/sql/sql_select.cc:5104
      #14 0x000060a897fd65a7 in JOIN::exec (this=0x6c02783291a0)at /test/13.1_opt/sql/sql_select.cc:4914
      #15 mysql_select (thd=thd@entry=0x6c0278000c70, tables=<optimized out>, fields=@0x6c027801c8b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6c027801cc30, last = 0x6c027832e5a0, elements = 11}, <No data fields>}, conds=<optimized out>, og_num=<optimized out>, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x6c027801f850, unit=0x6c0278005230, select_lex=0x6c027801c600)at /test/13.1_opt/sql/sql_select.cc:5440
      #16 0x000060a897fd61c0 in handle_select (thd=thd@entry=0x6c0278000c70, lex=lex@entry=0x6c0278005150, result=result@entry=0x6c027801f850, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/13.1_opt/sql/sql_select.cc:637
      #17 0x000060a897fa1c87 in execute_sqlcom_select (thd=thd@entry=0x6c0278000c70, all_tables=0x6c027801cc90) at /test/13.1_opt/sql/sql_parse.cc:6229
      #18 0x000060a897f9d4c7 in mysql_execute_command (thd=thd@entry=0x6c0278000c70, is_called_from_prepared_stmt=false) at /test/13.1_opt/sql/sql_parse.cc:3997
      #19 0x000060a897f9872d in mysql_parse (thd=thd@entry=0x6c0278000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7403785fe4e0)at /test/13.1_opt/sql/sql_parse.cc:7968
      #20 0x000060a897f96f05 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x6c0278000c70, packet=packet@entry=0x6c0278008e61 "", packet_length=packet_length@entry=137, blocking=true)at /test/13.1_opt/sql/sql_parse.cc:1903
      #21 0x000060a897f98bb0 in do_command (thd=thd@entry=0x6c0278000c70, blocking=true) at /test/13.1_opt/sql/sql_parse.cc:1437
      #22 0x000060a8980c479d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x60a8d0a8eae0, put_in_cache=true)at /test/13.1_opt/sql/sql_connect.cc:1514
      #23 0x000060a8980c45d2 in handle_one_connection (arg=arg@entry=0x60a8d0a8eae0)at /test/13.1_opt/sql/sql_connect.cc:1426
      #24 0x000060a898471b73 in pfs_spawn_thread (arg=0x60a8d0aaf640)at /test/13.1_opt/storage/perfschema/pfs.cc:2198
      #25 0x00007403a709cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #26 0x00007403a7129d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      CS 13.1.0 da18481158c81ca94689702073c3e04aad85a6a3 (Debug, Clang 22.1.8-20260622) Build 18/08/2026

      Core was generated by `/test/MD180826-mariadb-13.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1390175)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000077ae86a4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000077ae86a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000077ae86ea5ff5 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
      #6  0x000077ae86ebb0da in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
      #7  0x000077ae86ea5a55 in std::terminate() ()
         from /lib/x86_64-linux-gnu/libstdc++.so.6
      #8  0x000077ae86ebb391 in __cxa_throw ()
         from /lib/x86_64-linux-gnu/libstdc++.so.6
      #9  0x00006fadabb9df16 in duckdb::TryCast::Operation<duckdb::timestamp_tz_t, float> (input={<duckdb::timestamp_t> = {value = 1787174287144691}, <No data fields>}, result=@0x77ae5f959f44: 0, strict=false)at /test/13.1_dbg/storage/duckdb/third_parties/duckdb/src/include/duckdb/common/operator/cast_operators.hpp:38
      #10 0x00006fadabb9d293 in duckdb::Cast::Operation<duckdb::timestamp_tz_t, float> (input={<duckdb::timestamp_t> = {value = 1787174287144691}, <No data fields>})at /test/13.1_dbg/storage/duckdb/third_parties/duckdb/src/include/duckdb/common/operator/cast_operators.hpp:75
      #11 0x00006fadabb4e221 in duckdb::Value::GetValueInternal<float> (this=0x77ae5f95a590)at /test/13.1_dbg/storage/duckdb/third_parties/duckdb/src/common/types/value.cpp:1203
      #12 0x00006fadaba71225 in duckdb::Value::GetValue<float> (this=0x77ae5f95a590)at /test/13.1_dbg/storage/duckdb/third_parties/duckdb/src/common/types/value.cpp:1310
      #13 0x00006fadab6bafe9 in store_duckdb_field_in_mysql_format (field=0x6fadb4380f20, value=@0x77ae5f95a590: {type_ = {id_ = duckdb::LogicalTypeId::TIMESTAMP_TZ, physical_type_ = duckdb::PhysicalType::INT64, type_info_ = {internal = std::shared_ptr<struct duckdb::ExtraTypeInfo> (empty) = {        get() = 0x0      }}, static SQLNULL = duckdb::LogicalTypeId::SQLNULL, static UNKNOWN = duckdb::LogicalTypeId::UNKNOWN, static BOOLEAN = duckdb::LogicalTypeId::BOOLEAN, static TINYINT = duckdb::LogicalTypeId::TINYINT, static UTINYINT = duckdb::LogicalTypeId::UTINYINT, static SMALLINT = duckdb::LogicalTypeId::SMALLINT, static USMALLINT = duckdb::LogicalTypeId::USMALLINT, static INTEGER = duckdb::LogicalTypeId::INTEGER, static UINTEGER = duckdb::LogicalTypeId::UINTEGER, static BIGINT = duckdb::LogicalTypeId::BIGINT, static UBIGINT = duckdb::LogicalTypeId::UBIGINT, static FLOAT = duckdb::LogicalTypeId::FLOAT, static DOUBLE = duckdb::LogicalTypeId::DOUBLE, static DATE = duckdb::LogicalTypeId::DATE, static TIMESTAMP = duckdb::LogicalTypeId::TIMESTAMP, static TIMESTAMP_S = duckdb::LogicalTypeId::TIMESTAMP_SEC, static TIMESTAMP_MS = duckdb::LogicalTypeId::TIMESTAMP_MS, static TIMESTAMP_NS = duckdb::LogicalTypeId::TIMESTAMP_NS, static TIME = duckdb::LogicalTypeId::TIME, static TIME_NS = duckdb::LogicalTypeId::TIME_NS, static TIMESTAMP_TZ = duckdb::LogicalTypeId::TIMESTAMP_TZ, static TIME_TZ = duckdb::LogicalTypeId::TIME_TZ, static VARCHAR = duckdb::LogicalTypeId::VARCHAR, static ANY = duckdb::LogicalTypeId::ANY, static BLOB = duckdb::LogicalTypeId::BLOB, static BIT = duckdb::LogicalTypeId::BIT, static BIGNUM = duckdb::LogicalTypeId::BIGNUM, static INTERVAL = duckdb::LogicalTypeId::INTERVAL, static HUGEINT = duckdb::LogicalTypeId::HUGEINT, static UHUGEINT = duckdb::LogicalTypeId::UHUGEINT, static UUID = duckdb::LogicalTypeId::UUID, static HASH = duckdb::LogicalTypeId::UBIGINT, static POINTER = duckdb::LogicalTypeId::POINTER, static TABLE = duckdb::LogicalTypeId::TABLE, static LAMBDA = duckdb::LogicalTypeId::LAMBDA, static INVALID = duckdb::LogicalTypeId::INVALID, static ROW_TYPE = duckdb::LogicalTypeId::BIGINT, static JSON_TYPE_NAME = <optimized out>}, is_null = false, value_ = {boolean = 243, tinyint = -13 '\363', smallint = 30451, integer = -259426573, bigint = 1787174287144691, utinyint = 243 '\363', usmallint = 30451, uinteger = 4035540723, ubigint = 1787174287144691, hugeint = {lower = 1787174287144691, upper = 122791840063664}, uhugeint = {lower = 1787174287144691, upper = 122791840063664}, float_ = -3.40345977e+29, double_ = 8.8298141840901116e-309, pointer = 1787174287144691, hash = 1787174287144691, date = {days = -259426573}, time = {micros = 1787174287144691}, time_ns = {<duckdb::dtime_t> = {micros = 1787174287144691}, <No data fields>}, timetz = {static TIME_BITS = 40, static OFFSET_BITS = 24, static OFFSET_MASK = 16777215, static MAX_OFFSET = 57599, static MIN_OFFSET = -57599, static OFFSET_MICROS = 1000000, bits = 1787174287144691}, timestamp = {value = 1787174287144691}, timestamp_s = {<duckdb::timestamp_t> = {value = 1787174287144691}, <No data fields>}, timestamp_ms = {<duckdb::timestamp_t> = {value = 1787174287144691}, <No data fields>}, timestamp_ns = {<duckdb::timestamp_t> = {value = 1787174287144691}, <No data fields>}, timestamp_tz = {<duckdb::timestamp_t> = {value = 1787174287144691}, <No data fields>}, interval = {months = -259426573, days = 416108, micros = 122791840063664}}, value_info_ = {internal = std::shared_ptr<struct duckdb::ExtraValueInfo> (empty) = {      get() = 0x0    }}}, thd=0x6fadb4000d60)at /test/13.1_dbg/storage/duckdb/convertor/duckdb_select.cc:145
      #14 0x00006fadab63b5af in ha_duckdb_select_handler::next_row (this=0x6fadb437da20)at /test/13.1_dbg/storage/duckdb/ha_duckdb_pushdown.cc:922
      #15 0x00005f3c5b004e6e in select_handler::execute (this=0x6fadb437da20)at /test/13.1_dbg/sql/select_handler.cc:172
      #16 0x00005f3c5af961ad in JOIN::exec_inner (this=0x6fadb4356320)at /test/13.1_dbg/sql/sql_select.cc:5104
      #17 0x00005f3c5af95633 in JOIN::exec (this=0x6fadb4356320)at /test/13.1_dbg/sql/sql_select.cc:4914
      #18 0x00005f3c5af736db in mysql_select (thd=0x6fadb4000d60, tables=0x6fadb401f4f0, fields=@0x6fadb401f118: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6fadb401f490, last = 0x6fadb435b730, elements = 11}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6fadb40220b0, unit=0x6fadb40052f8, select_lex=0x6fadb401ee60) at /test/13.1_dbg/sql/sql_select.cc:5440
      #19 0x00005f3c5af7323d in handle_select (thd=0x6fadb4000d60, lex=0x6fadb4005218, result=0x6fadb40220b0, setup_tables_done_option=0)at /test/13.1_dbg/sql/sql_select.cc:637
      #20 0x00005f3c5af19056 in execute_sqlcom_select (thd=0x6fadb4000d60, all_tables=0x6fadb401f4f0) at /test/13.1_dbg/sql/sql_parse.cc:6229
      #21 0x00005f3c5af0f2bb in mysql_execute_command (thd=0x6fadb4000d60, is_called_from_prepared_stmt=false) at /test/13.1_dbg/sql/sql_parse.cc:3997
      #22 0x00005f3c5af08048 in mysql_parse (thd=0x6fadb4000d60, rawbuf=0x6fadb401a490 "WITH a AS (SELECT * FROM t1),b AS (SELECT * FROM t1),c AS (SELECT * FROM t2) SELECT * FROM a JOIN b ON a.c2=b.c2 LEFT JOIN c ON b.c2=c.c2", length=137, parser_state=0x77ae5f95c9c0)at /test/13.1_dbg/sql/sql_parse.cc:7968
      #23 0x00005f3c5af0576e in dispatch_command (command=COM_QUERY, thd=0x6fadb4000d60, packet=0x6fadb400b6c1 "", packet_length=137, blocking=true) at /test/13.1_dbg/sql/sql_parse.cc:1903
      #24 0x00005f3c5af08aca in do_command (thd=0x6fadb4000d60, blocking=true)at /test/13.1_dbg/sql/sql_parse.cc:1437
      #25 0x00005f3c5b0e002e in do_handle_one_connection (connect=0x5f3c6bf3db60, put_in_cache=true) at /test/13.1_dbg/sql/sql_connect.cc:1514
      #26 0x00005f3c5b0dfe11 in handle_one_connection (arg=0x5f3c6bf23c50)at /test/13.1_dbg/sql/sql_connect.cc:1426
      #27 0x000077ae86a9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #28 0x000077ae86b29d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  180826  8f00e6caca633c783140db86d3a48a96de67cf38  No bug found                  
      CS  10.11  opt  180826  8f00e6caca633c783140db86d3a48a96de67cf38  No bug found                  
      CS  11.4   dbg  180826  1a052f27e374fc9b4cb5b1fd098cf10f0e1381cc  No bug found                  
      CS  11.4   opt  180826  1a052f27e374fc9b4cb5b1fd098cf10f0e1381cc  No bug found                  
      CS  11.8   dbg  180826  d26f9ab217a7fcf9d4eccc62c01020ff275ff42e  SIGABRT|__cxa_throw|duckdb::TryCast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Cast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Value::GetValueInternal<float>
      CS  11.8   opt  180826  d26f9ab217a7fcf9d4eccc62c01020ff275ff42e  SIGABRT|__cxa_throw|float duckdb::Value::GetValueInternal<float>|store_duckdb_field_in_mysql_format|ha_duckdb_select_handler::next_row
      CS  12.3   dbg  180826  add63991988734383c5e942de2a19c6c45f511f7  SIGABRT|__cxa_throw|duckdb::TryCast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Cast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Value::GetValueInternal<float>
      CS  12.3   opt  180826  add63991988734383c5e942de2a19c6c45f511f7  SIGABRT|__cxa_throw|float duckdb::Value::GetValueInternal<float>|store_duckdb_field_in_mysql_format|ha_duckdb_select_handler::next_row
      CS  13.0   dbg  180826  a848493c6fe031f23606144420c1ca1e467cbd81  SIGABRT|__cxa_throw|duckdb::TryCast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Cast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Value::GetValueInternal<float>
      CS  13.0   opt  180826  a848493c6fe031f23606144420c1ca1e467cbd81  SIGABRT|__cxa_throw|float duckdb::Value::GetValueInternal<float>|store_duckdb_field_in_mysql_format|ha_duckdb_select_handler::next_row
      CS  13.1   dbg  180826  da18481158c81ca94689702073c3e04aad85a6a3  SIGABRT|__cxa_throw|duckdb::TryCast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Cast::Operation<duckdb::timestamp_tz_t, float>|duckdb::Value::GetValueInternal<float>
      CS  13.1   opt  180826  da18481158c81ca94689702073c3e04aad85a6a3  SIGABRT|__cxa_throw|float duckdb::Value::GetValueInternal<float>|store_duckdb_field_in_mysql_format|ha_duckdb_select_handler::next_row
      ES  10.6   dbg  180826  fcecb2620f25965723d640decede7c018bcb1dcc  No bug found                  
      ES  10.6   opt  180826  fcecb2620f25965723d640decede7c018bcb1dcc  No bug found                  
      ES  11.4   dbg  180826  3b34189bfe675c18c4ced3ef531d016ea74c76f4  No bug found                  
      ES  11.4   opt  180826  3b34189bfe675c18c4ced3ef531d016ea74c76f4  No bug found                  
      ES  11.8   dbg  180826  4694e931d10fecf733c34f83ea2146d31b708eb3  No bug found                  
      ES  11.8   opt  180826  4694e931d10fecf733c34f83ea2146d31b708eb3  No bug found                  
      ES  12.3   dbg  180826  f513f503feacabfb219d4a6f965b5f72b86d4db0  No bug found                  
      ES  12.3   opt  180826  f513f503feacabfb219d4a6f965b5f72b86d4db0  No bug found                   
      

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 0.5h Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - 0.5h Remaining Estimate - 1h
                  0.5h

                  Git Integration

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