mariadb/mysql-test/main/tmp_table_binlog.result
Nikita Malyavin 5e797055a8 MDEV-37719 use-after-free on CREATE OR REPLACE TEMPORARY TABLE LIKE
use-after-free on logged CREATE OR REPLACE TEMPORARY TABLE
LIKE not-logged-table.

A temporary table is dropped as part of create_table_impl, however its
traces still were in table_list and create_info.

Reset both.
2025-10-10 15:28:49 +02:00

43 lines
1.4 KiB
Text

#
# MDEV-36563 Assertion `!mysql_bin_log.is_open()' failed in
# THD::mark_tmp_table_as_free_for_reuse upon REPAIR
#
CREATE TEMPORARY TABLE t1 (c INT);
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
DROP TABLE t1;
CREATE TEMPORARY TABLE t1 (c INT) engine=innodb;
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
DROP TABLE t1;
set sql_mode='strict_all_tables';
SET @@session.binlog_format=statement;
CREATE TEMPORARY TABLE t1(a CHAR(3));
insert into t1 values ("a"),("abcd"),("b");
ERROR 22001: Data too long for column 'a' at row 2
select * from t1;
a
a
drop table t1;
set sql_mode=default;
CREATE TABLE t1 (c CHAR(3));
INSERT INTO t1 VALUES ("a"),("a");
CREATE TEMPORARY TABLE t2 (c CHAR(1) primary key);
INSERT INTO t2 (c) VALUES ('b');
INSERT INTO t2 (c) VALUES ('b');
ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
drop table t1,t2;
# MDEV-37719 use-after-free on logged CREATE OR REPLACE TEMPORARY TABLE LIKE not-logged-table
set binlog_format=mixed;
create temporary table t1 (x int);
create temporary table t2 (y int);
set @save_create_tmp_table_binlog_formats=@@create_tmp_table_binlog_formats;
set create_tmp_table_binlog_formats=mixed;
Warnings:
Warning 1292 Truncated incorrect create_tmp_table_binlog_formats value: 'MIXED'
create or replace temporary table t2 like t1;
drop table t1, t2;
set create_tmp_table_binlog_formats=@save_create_tmp_table_binlog_formats;
set binlog_format=statement;