Commit edebd2a2 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of:

-----------------------------------------------------------
revno: 2630.2.4
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-runtime
timestamp: Fri 2008-05-23 02:42:32 +0400
message:
  Bug#27430 "Crash in subquery code when in PS and table DDL changed after
  PREPARE"
  Add a test case for the situation with small TDC and many merge children.

from 6.0-codebase.

mysql-test/r/merge.result:
  Update results (Bug#27430)
mysql-test/t/merge.test:
  Add test case (Bug#27430)
parent 9a4a845a
......@@ -2220,3 +2220,39 @@ tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH R
DROP TRIGGER tr1;
DROP TABLE t1, t2, t3;
End of 5.1 tests
#
# An additional test case for Bug#27430 Crash in subquery code
# when in PS and table DDL changed after PREPARE
#
# Test merge table with too many merge children.
#
drop table if exists t_parent;
set @save_table_definition_cache=@@global.table_definition_cache;
#
# Set @@global.table_definition_cache to minimum
#
set @@global.table_definition_cache=400;
set @a=null;
#
# Create 400 merge children
#
set @a=concat("create table t_parent (a int) union(", @a,
") insert_method=first engine=mrg_myisam");
prepare stmt from @a;
execute stmt;
prepare stmt from "select * from t_parent";
execute stmt;
ERROR HY000: Prepared statement needs to be re-prepared
execute stmt;
ERROR HY000: Prepared statement needs to be re-prepared
execute stmt;
ERROR HY000: Prepared statement needs to be re-prepared
deallocate prepare stmt;
#
# Create merge parent
#
#
# Cleanup
#
drop table t_parent;
set @@global.table_definition_cache=@save_table_definition_cache;
......@@ -1634,3 +1634,63 @@ DROP TRIGGER tr1;
DROP TABLE t1, t2, t3;
--echo End of 5.1 tests
--echo #
--echo # An additional test case for Bug#27430 Crash in subquery code
--echo # when in PS and table DDL changed after PREPARE
--echo #
--echo # Test merge table with too many merge children.
--echo #
--disable_warnings
drop table if exists t_parent;
--enable_warnings
set @save_table_definition_cache=@@global.table_definition_cache;
--echo #
--echo # Set @@global.table_definition_cache to minimum
--echo #
set @@global.table_definition_cache=400;
set @a=null;
let $1 = 400;
--echo #
--echo # Create 400 merge children
--echo #
--disable_query_log
while ($1)
{
--disable_warnings
eval drop table if exists t$1;
--enable_warnings
eval create table t$1 (a int) engine=myisam;
eval set @a=ifnull(concat(@a, ", ", "t$1"), "t$1");
dec $1;
}
--enable_query_log
set @a=concat("create table t_parent (a int) union(", @a,
") insert_method=first engine=mrg_myisam");
prepare stmt from @a;
execute stmt;
prepare stmt from "select * from t_parent";
--error ER_NEED_REPREPARE
execute stmt;
--error ER_NEED_REPREPARE
execute stmt;
--error ER_NEED_REPREPARE
execute stmt;
deallocate prepare stmt;
--echo #
--echo # Create merge parent
--echo #
--echo #
--echo # Cleanup
--echo #
let $1 = 400;
--disable_query_log
while ($1)
{
eval drop table t$1;
dec $1;
}
--enable_query_log
drop table t_parent;
set @@global.table_definition_cache=@save_table_definition_cache;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment