mariadb/mysql-test/suite/binlog/r/binlog_tmp_table.result
Alfranio Correia 23d032c34e BUG#35583 mysqlbinlog replay fails with ERROR 1146 when temp tables are used
When using CREATE TEMPORARY TABLE LIKE to create a temporary table, 
or using TRUNCATE to delete all rows of a temporary table, they 
did not set the tmp_table_used flag, and cause the omission of
"SET @@session.pseudo_thread_id" when dumping binlog with mysqlbinlog,
and cause error when replay the statements.
      
This patch fixed the problem by setting tmp_table_used in these two
cases. (Done by He Zhenxing 2009-01-12)


mysql-test/suite/binlog/r/binlog_tmp_table.result:
  Add test case for BUG#35583
mysql-test/suite/binlog/t/binlog_tmp_table.test:
  Add test case for BUG#35583
sql/sql_delete.cc:
  set thd->tmp_table_used when truncate temporary table
sql/sql_table.cc:
  set thd->tmp_table_used when using create like to create temporary tables
2009-01-28 14:35:12 +00:00

30 lines
600 B
Text

create table foo (a int);
flush logs;
create temporary table tmp1_foo like foo;
create temporary table tmp2_foo (a int);
insert into tmp1_foo values (1), (2), (3), (4);
replace into tmp2_foo values (1), (2), (3), (4);
update tmp1_foo set a=2*a-1;
update tmp2_foo set a=2*a;
delete from tmp1_foo where a < 5;
delete from tmp2_foo where a < 5;
insert into foo select * from tmp1_foo;
insert into foo select * from tmp2_foo;
truncate table tmp1_foo;
truncate table tmp2_foo;
flush logs;
select * from foo;
a
5
7
6
8
drop table foo;
create table foo (a int);
select * from foo;
a
5
7
6
8
drop table foo;