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`)) |
For the record, another assertion failure which was apparently fixed by the same patch:
10.2 dc8e15db
mysqld: /data/src/10.2/sql/sql_truncate.cc:159: bool fk_truncate_illegal_if_parent(THD*, TABLE*): Assertion `!((system_charset_info)->coll->strcasecmp((system_charset_info), (fk_info->referenced_table->str), (table->s->table_name.str)))' failed.
190502 16:47:27 [ERROR] mysqld got signal 6 ;
#7 0x00007f1bffcf2ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x000056427076a730 in fk_truncate_illegal_if_parent (thd=0x7f1bb0000b00, table=0x7f1bb004d4b0) at /data/src/10.2/sql/sql_truncate.cc:157
#9 0x000056427076a95a in Sql_cmd_truncate_table::handler_truncate (this=0x7f1bb0012b40, thd=0x7f1bb0000b00, table_ref=0x7f1bb0012528, is_tmp_table=false) at /data/src/10.2/sql/sql_truncate.cc:242
#10 0x000056427076afdd in Sql_cmd_truncate_table::truncate_table (this=0x7f1bb0012b40, thd=0x7f1bb0000b00, table_ref=0x7f1bb0012528) at /data/src/10.2/sql/sql_truncate.cc:442
#11 0x000056427076b14e in Sql_cmd_truncate_table::execute (this=0x7f1bb0012b40, thd=0x7f1bb0000b00) at /data/src/10.2/sql/sql_truncate.cc:499
#12 0x0000564270323c22 in mysql_execute_command (thd=0x7f1bb0000b00) at /data/src/10.2/sql/sql_parse.cc:6226
#13 0x0000564270328a73 in mysql_parse (thd=0x7f1bb0000b00, rawbuf=0x7f1bb0012458 "TRUNCATE TABLE t1", length=17, parser_state=0x7f1bf81b8200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8013
#14 0x0000564270316570 in dispatch_command (command=COM_QUERY, thd=0x7f1bb0000b00, packet=0x7f1bb0095fa1 "TRUNCATE TABLE t1", packet_length=17, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1833
#15 0x0000564270314e8d in do_command (thd=0x7f1bb0000b00) at /data/src/10.2/sql/sql_parse.cc:1387
#16 0x0000564270468a99 in do_handle_one_connection (connect=0x56427456ab70) at /data/src/10.2/sql/sql_connect.cc:1335
#17 0x0000564270468826 in handle_one_connection (arg=0x56427456ab70) at /data/src/10.2/sql/sql_connect.cc:1241
#18 0x00005642707d095c in pfs_spawn_thread (arg=0x56427458dd80) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#19 0x00007f1c01de7494 in start_thread (arg=0x7f1bf81b9700) at pthread_create.c:333
#20 0x00007f1bffdaf93f in clone () from /lib/x86_64-linux-gnu/libc.so.6