Commit 7e2fa49e authored by Georgi Kodinov's avatar Georgi Kodinov

merge

parents f9948a3e 17e509b2
......@@ -12,7 +12,7 @@ dnl
dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb.
AC_INIT([MySQL Server], [5.1.52], [], [mysql])
AC_INIT([MySQL Server], [5.1.54], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
......
......@@ -3001,4 +3001,42 @@ EXECUTE stmt;
1
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
#
# Bug#54494 crash with explain extended and prepared statements
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
#
# Bug#54488 crash when using explain and prepared statements with subqueries
#
CREATE TABLE t1(f1 INT);
INSERT INTO t1 VALUES (1),(1);
PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.
create table A(id int not null primary key) engine=innodb;
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb;
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb;
insert into A values(1), (2);
DELETE FROM A where id = 1;
DELETE FROM C where f1 = 2;
DELETE FROM A where id = 1;
DROP TABLE C;
DROP TABLE B;
DROP TABLE A;
# Test Bug #57255. Cascade deletes that affect different rows should not
# result in DB_FOREIGN_EXCEED_MAX_CASCADE error
--source include/have_innodb.inc
create table A(id int not null primary key) engine=innodb;
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb;
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb;
insert into A values(1), (2);
--disable_query_log
let $i=257;
while ($i)
{
insert into B(f1) values(1);
dec $i;
}
let $i=486;
while ($i)
{
insert into C(f1) values(2);
dec $i;
}
--enable_query_log
# Following Deletes should not report error
DELETE FROM A where id = 1;
DELETE FROM C where f1 = 2;
DELETE FROM A where id = 1;
DROP TABLE C;
DROP TABLE B;
DROP TABLE A;
create table A(id int not null primary key) engine=innodb;
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb;
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb;
insert into A values(1), (2);
DELETE FROM A where id = 1;
DELETE FROM C where f1 = 2;
DELETE FROM A where id = 1;
DROP TABLE C;
DROP TABLE B;
DROP TABLE A;
# Test Bug #57255. Cascade deletes that affect different rows should not
# result in DB_FOREIGN_EXCEED_MAX_CASCADE error
--source include/have_innodb_plugin.inc
create table A(id int not null primary key) engine=innodb;
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb;
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb;
insert into A values(1), (2);
--disable_query_log
let $i=257;
while ($i)
{
insert into B(f1) values(1);
dec $i;
}
let $i=486;
while ($i)
{
insert into C(f1) values(2);
dec $i;
}
--enable_query_log
# Following Deletes should not report error
DELETE FROM A where id = 1;
DELETE FROM C where f1 = 2;
DELETE FROM A where id = 1;
DROP TABLE C;
DROP TABLE B;
DROP TABLE A;
......@@ -3079,4 +3079,26 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo #
--echo # Bug#54494 crash with explain extended and prepared statements
--echo #
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1';
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo #
--echo # Bug#54488 crash when using explain and prepared statements with subqueries
--echo #
CREATE TABLE t1(f1 INT);
INSERT INTO t1 VALUES (1),(1);
PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))';
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo End of 5.1 tests.
......@@ -1907,7 +1907,10 @@ int subselect_single_select_engine::exec()
}
if (!select_lex->uncacheable && thd->lex->describe &&
!(join->select_options & SELECT_DESCRIBE) &&
join->need_tmp && item->const_item())
join->need_tmp)
{
item->update_used_tables();
if (item->const_item())
{
/*
Force join->join_tmp creation, because this subquery will be replaced
......@@ -1920,6 +1923,7 @@ int subselect_single_select_engine::exec()
if (join->init_save_join_tab())
DBUG_RETURN(1); /* purecov: inspected */
}
}
if (item->engine_changed)
{
DBUG_RETURN(1);
......
......@@ -2362,11 +2362,15 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
sl->where= sl->prep_where->copy_andor_structure(thd);
sl->where->cleanup();
}
else
sl->where= NULL;
if (sl->prep_having)
{
sl->having= sl->prep_having->copy_andor_structure(thd);
sl->having->cleanup();
}
else
sl->having= NULL;
DBUG_ASSERT(sl->join == 0);
ORDER *order;
/* Fix GROUP list */
......
......@@ -1613,6 +1613,9 @@ row_update_cascade_for_mysql(
trx = thr_get_trx(thr);
/* Increment fk_cascade_depth to record the recursive call depth on
a single update/delete that affects multiple tables chained
together with foreign key relations. */
thr->fk_cascade_depth++;
if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) {
......@@ -1624,6 +1627,12 @@ row_update_cascade_for_mysql(
row_upd_step(thr);
/* The recursive call for cascading update/delete happens
in above row_upd_step(), reset the counter once we come
out of the recursive call, so it does not accumulate for
different row deletes */
thr->fk_cascade_depth = 0;
err = trx->error_state;
/* Note that the cascade node is a subnode of another InnoDB
......
......@@ -39,9 +39,13 @@
2010-10-11 The InnoDB Team
* row/row0sel.c:
Fix Bug#57345 btr_pcur_store_position abort for load with concurrent
lock/unlock tables
* row/row0sel.c
Fix Bug #57345 btr_pcur_store_position abort for load with
concurrent lock/unlock tables
2010-10-06 The InnoDB Team
* row/row0mysql.c, innodb_bug57255.result, innodb_bug57255.test
Fix Bug #Cascade Delete results in "Got error -1 from storage engine"
2010-09-27 The InnoDB Team
......
......@@ -1593,6 +1593,9 @@ row_update_cascade_for_mysql(
trx = thr_get_trx(thr);
/* Increment fk_cascade_depth to record the recursive call depth on
a single update/delete that affects multiple tables chained
together with foreign key relations. */
thr->fk_cascade_depth++;
if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) {
......@@ -1604,6 +1607,12 @@ row_update_cascade_for_mysql(
row_upd_step(thr);
/* The recursive call for cascading update/delete happens
in above row_upd_step(), reset the counter once we come
out of the recursive call, so it does not accumulate for
different row deletes */
thr->fk_cascade_depth = 0;
err = trx->error_state;
/* Note that the cascade node is a subnode of another InnoDB
......
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