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

Assertion `ptr >= name' failed in normalize_table_name_c_low upon creating CTE with name of existing tmp table

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      DROP TABLE IF EXISTS t, cte;
      CREATE TABLE t ENGINE=InnoDB AS SELECT 1 AS i;
      CREATE TEMPORARY TABLE cte ENGINE=InnoDB AS SELECT 2 AS f;
      WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte;
      

      10.2 54a995cd2206995f6dd675cabdce12a4b7ff7540

      mysqld: /data/src/10.2/storage/innobase/handler/ha_innodb.cc:5803: void normalize_table_name_c_low(char*, const char*, ulint): Assertion `ptr >= name' failed.
      170422 18:04:18 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7e78d07312 in __GI___assert_fail (assertion=0x7f7e7bf53f47 "ptr >= name", file=0x7f7e7bf51118 "/data/src/10.2/storage/innobase/handler/ha_innodb.cc", line=5803, function=0x7f7e7bf601a0 <normalize_table_name_c_low(char*, char const*, unsigned long)::__PRETTY_FUNCTION__> "void normalize_table_name_c_low(char*, const char*, ulint)") at assert.c:101
      #8  0x00007f7e7b9286f8 in normalize_table_name_c_low (norm_name=0x7f7e6c356090 "\260`5l~\177", name=0x7f7e2016b345 "cte", set_lower_case=0) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:5803
      #9  0x00007f7e7b928801 in create_table_info_t::normalize_table_name_low (norm_name=0x7f7e6c356090 "\260`5l~\177", name=0x7f7e2016b345 "cte", set_lower_case=0) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:5844
      #10 0x00007f7e7b93a4d1 in ha_innobase::delete_table (this=0x7f7e2016c278, name=0x7f7e2016b345 "cte") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:13810
      #11 0x00007f7e7b625948 in handler::drop_table (this=0x7f7e2016c278, name=0x7f7e2016b345 "cte") at /data/src/10.2/sql/handler.cc:3930
      #12 0x00007f7e7b626552 in handler::ha_drop_table (this=0x7f7e2016c278, name=0x7f7e2016b345 "cte") at /data/src/10.2/sql/handler.cc:4352
      #13 0x00007f7e7b41e6fd in free_tmp_table (thd=0x7f7e20000b00, entry=0x7f7e201693f0) at /data/src/10.2/sql/sql_select.cc:17773
      #14 0x00007f7e7b33de7b in close_thread_tables (thd=0x7f7e20000b00) at /data/src/10.2/sql/sql_base.cc:767
      #15 0x00007f7e7b3ba54d in mysql_execute_command (thd=0x7f7e20000b00) at /data/src/10.2/sql/sql_parse.cc:6255
      #16 0x00007f7e7b3bebf6 in mysql_parse (thd=0x7f7e20000b00, rawbuf=0x7f7e20012348 "WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte", length=49, parser_state=0x7f7e6c357210, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7874
      #17 0x00007f7e7b3accce in dispatch_command (command=COM_QUERY, thd=0x7f7e20000b00, packet=0x7f7e201498f1 "", packet_length=49, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1812
      #18 0x00007f7e7b3ab63e in do_command (thd=0x7f7e20000b00) at /data/src/10.2/sql/sql_parse.cc:1362
      #19 0x00007f7e7b4f5e05 in do_handle_one_connection (connect=0x7f7e7e7b2d10) at /data/src/10.2/sql/sql_connect.cc:1354
      #20 0x00007f7e7b4f5b92 in handle_one_connection (arg=0x7f7e7e7b2d10) at /data/src/10.2/sql/sql_connect.cc:1260
      #21 0x00007f7e7b90eeb8 in pfs_spawn_thread (arg=0x7f7e7e7bdb60) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #22 0x00007f7e7a9d1064 in start_thread (arg=0x7f7e6c358700) at pthread_create.c:309
      #23 0x00007f7e78dc162d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Note:

      With MyISAM it also fails, but on a different assertion:

      DROP TABLE IF EXISTS t, cte;
      CREATE TABLE t ENGINE=MyISAM AS SELECT 1 AS i;
      CREATE TEMPORARY TABLE cte ENGINE=MyISAM AS SELECT 2 AS f;
      WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte;
      

      mysqld: /data/src/10.2/sql/sql_error.cc:487: void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_condition*): Assertion `! is_set() || m_can_overwrite_status' failed.
      170422 18:09:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f120f9d9312 in __GI___assert_fail (assertion=0x7f1212ae01a8 "! is_set() || m_can_overwrite_status", file=0x7f1212ae0068 "/data/src/10.2/sql/sql_error.cc", line=487, function=0x7f1212ae0640 <Diagnostics_area::set_error_status(unsigned int, char const*, char const*, Sql_condition const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_condition*)") at assert.c:101
      #8  0x00007f121205707d in Diagnostics_area::set_error_status (this=0x7f11f8005ae8, sql_errno=6, message=0x7f1209e9bbf0 "Error on delete of 'cte.MYI' (Errcode: 2 \"No such file or directory\")", sqlstate=0x7f1212afb34d "HY000", error_condition=0x0) at /data/src/10.2/sql/sql_error.cc:487
      #9  0x00007f1212038c45 in THD::raise_condition (this=0x7f11f8000b00, sql_errno=6, sqlstate=0x7f1212afb34d "HY000", level=Sql_condition::WARN_LEVEL_ERROR, msg=0x7f1209e9bbf0 "Error on delete of 'cte.MYI' (Errcode: 2 \"No such file or directory\")") at /data/src/10.2/sql/sql_class.cc:1130
      #10 0x00007f1211fa6672 in my_message_sql (error=6, str=0x7f1209e9bbf0 "Error on delete of 'cte.MYI' (Errcode: 2 \"No such file or directory\")", MyFlags=36) at /data/src/10.2/sql/mysqld.cc:3616
      #11 0x00007f1212a4300b in my_error (nr=6, MyFlags=36) at /data/src/10.2/mysys/my_error.c:125
      #12 0x00007f1212a42d8c in my_delete (name=0x7f1209e9c230 "cte.MYI", MyFlags=16) at /data/src/10.2/mysys/my_delete.c:49
      #13 0x00007f1212a4f3b8 in my_handler_delete_with_symlink (filename=0x7f1209e9c230 "cte.MYI", sync_dir=16) at /data/src/10.2/mysys/my_symlink2.c:188
      #14 0x00007f12129b9bcd in inline_mysql_file_delete_with_symlink (key=37, src_file=0x7f1212d7e088 "/data/src/10.2/storage/myisam/mi_delete_table.c", src_line=37, name=0x7f11f804ea05 "cte", ext=0x7f1212d7e0c8 ".MYI", flags=16) at /data/src/10.2/include/mysql/psi/mysql_file.h:1360
      #15 0x00007f12129b9c97 in mi_delete_table (name=0x7f11f804ea05 "cte") at /data/src/10.2/storage/myisam/mi_delete_table.c:37
      #16 0x00007f121299f218 in ha_myisam::delete_table (this=0x7f11f8050b18, name=0x7f11f804ea05 "cte") at /data/src/10.2/storage/myisam/ha_myisam.cc:2050
      #17 0x00007f12122f7948 in handler::drop_table (this=0x7f11f8050b18, name=0x7f11f804ea05 "cte") at /data/src/10.2/sql/handler.cc:3930
      #18 0x00007f12122f8552 in handler::ha_drop_table (this=0x7f11f8050b18, name=0x7f11f804ea05 "cte") at /data/src/10.2/sql/handler.cc:4352
      #19 0x00007f12120f06fd in free_tmp_table (thd=0x7f11f8000b00, entry=0x7f11f804ff10) at /data/src/10.2/sql/sql_select.cc:17773
      #20 0x00007f121200fe7b in close_thread_tables (thd=0x7f11f8000b00) at /data/src/10.2/sql/sql_base.cc:767
      #21 0x00007f121208c54d in mysql_execute_command (thd=0x7f11f8000b00) at /data/src/10.2/sql/sql_parse.cc:6255
      #22 0x00007f1212090bf6 in mysql_parse (thd=0x7f11f8000b00, rawbuf=0x7f11f8012348 "WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte", length=49, parser_state=0x7f1209e9d210, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7874
      #23 0x00007f121207ecce in dispatch_command (command=COM_QUERY, thd=0x7f11f8000b00, packet=0x7f11f80087a1 "", packet_length=49, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1812
      #24 0x00007f121207d63e in do_command (thd=0x7f11f8000b00) at /data/src/10.2/sql/sql_parse.cc:1362
      #25 0x00007f12121c7e05 in do_handle_one_connection (connect=0x7f1214aec260) at /data/src/10.2/sql/sql_connect.cc:1354
      #26 0x00007f12121c7b92 in handle_one_connection (arg=0x7f1214aec260) at /data/src/10.2/sql/sql_connect.cc:1260
      #27 0x00007f12125e0eb8 in pfs_spawn_thread (arg=0x7f1214ac6b10) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #28 0x00007f12116a3064 in start_thread (arg=0x7f1209e9e700) at pthread_create.c:309
      #29 0x00007f120fa9362d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Note 2

      With recursive CTE it also fails, with a stack trace similar or identical to MDEV-12554.

      Attachments

        Activity

          People

            igor Igor Babaev
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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