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

Assertion `!lex_string_cmp(system_charset_info, fk_info->referenced_table, &table->s->table_name)' failed in fk_truncate_illegal_if_parent

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      SET FOREIGN_KEY_CHECKS= OFF;
      CREATE TABLE t1 (f2 INT, f4 INT, KEY(f2), FOREIGN KEY (f4) REFERENCES t3 (f4)) ENGINE=InnoDB;
      SET FOREIGN_KEY_CHECKS= ON;
      CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB;
      --error ER_CANT_CREATE_TABLE
      CREATE TABLE t3 (a INT) ENGINE=InnoDB;
      --error ER_ERROR_ON_RENAME
      ALTER TABLE t1 RENAME TO t3;
      ALTER TABLE t1 FORCE;
       
      TRUNCATE TABLE t1;
       
      # Cleanup
      DROP TABLE t2, t1, t3;
      

      10.3 69b33fca

      mysqld: /data/src/10.3/sql/sql_truncate.cc:156: bool fk_truncate_illegal_if_parent(THD*, TABLE*): Assertion `!lex_string_cmp(system_charset_info, fk_info->referenced_table, &table->s->table_name)' failed.
      190314 14:29:55 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fcb1509aee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000056165c97e5a8 in fk_truncate_illegal_if_parent (thd=0x7fcabc000b00, table=0x7fcabc054b20) at /data/src/10.3/sql/sql_truncate.cc:154
      #9  0x000056165c97e7c2 in Sql_cmd_truncate_table::handler_truncate (this=0x7fcabc015418, thd=0x7fcabc000b00, table_ref=0x7fcabc014dc8, is_tmp_table=false) at /data/src/10.3/sql/sql_truncate.cc:239
      #10 0x000056165c97eef5 in Sql_cmd_truncate_table::truncate_table (this=0x7fcabc015418, thd=0x7fcabc000b00, table_ref=0x7fcabc014dc8) at /data/src/10.3/sql/sql_truncate.cc:448
      #11 0x000056165c97f07a in Sql_cmd_truncate_table::execute (this=0x7fcabc015418, thd=0x7fcabc000b00) at /data/src/10.3/sql/sql_truncate.cc:504
      #12 0x000056165c4b871e in mysql_execute_command (thd=0x7fcabc000b00) at /data/src/10.3/sql/sql_parse.cc:6335
      #13 0x000056165c4bd7e0 in mysql_parse (thd=0x7fcabc000b00, rawbuf=0x7fcabc014cf8 "TRUNCATE TABLE t1", length=17, parser_state=0x7fcb0a3ad5f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8142
      #14 0x000056165c4aa8cb in dispatch_command (command=COM_QUERY, thd=0x7fcabc000b00, packet=0x7fcabc162281 "TRUNCATE TABLE t1", packet_length=17, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1854
      #15 0x000056165c4a92b5 in do_command (thd=0x7fcabc000b00) at /data/src/10.3/sql/sql_parse.cc:1396
      #16 0x000056165c611b2b in do_handle_one_connection (connect=0x56166054d070) at /data/src/10.3/sql/sql_connect.cc:1403
      #17 0x000056165c6118af in handle_one_connection (arg=0x56166054d070) at /data/src/10.3/sql/sql_connect.cc:1309
      #18 0x000056165caae207 in pfs_spawn_thread (arg=0x561660492400) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #19 0x00007fcb16d71494 in start_thread (arg=0x7fcb0a3ae700) at pthread_create.c:333
      #20 0x00007fcb1515793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Non-debug build produces the error upon TRUNCATE:

      query 'TRUNCATE TABLE t1' failed: 1701: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `test`.`t3` (`f2`))
      

      Attachments

        Activity

          People

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