mariadb/mysql-test/main/temp_table_frm.test
Yuchen Pei 0fa141ebb4
MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir
Fix a regression introduced in MDEV-35840 78157c4765

Also tested compiling with -O3 that the -Warray-bounds fixed in
MDEV-35840 does not resurface
2025-02-24 12:10:32 +11:00

38 lines
1.4 KiB
Text

#View cannot has temporary table in definition
-- source include/no_view_protocol.inc
#
# MDEV-4260 Don't create frm files for temporary tables
#
# Ensure we don't overflow the internal heap table size in the join
set @save_use_stat_tables= @@use_stat_tables;
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set @@optimizer_use_condition_selectivity=1;
set @@use_stat_tables= NEVER;
set @@session.max_heap_table_size=16*1024*1024;
create table t1 select * from information_schema.session_status where variable_name like 'Opened%';
create temporary table t2 (a int) engine=memory;
select variable_name, session_status.variable_value - t1.variable_value
from information_schema.session_status join t1 using (variable_name);
let $tmpdir= `select @@tmpdir`;
--list_files $tmpdir/ #sql*
truncate table t2;
select variable_name, session_status.variable_value - t1.variable_value
from information_schema.session_status join t1 using (variable_name);
set @@use_stat_tables= @save_use_stat_tables;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1;
--echo #
--echo # MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir
--echo #
create table t1 (c int);
let $MYSQLD_TMPDIR=`SELECT @@tmpdir`;
let $MYSQLD_DATADIR=`SELECT @@datadir`;
--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_TMPDIR/#sqlt1.frm
drop table t1;
--source include/restart_mysqld.inc