1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fix for LP bug#1007622

TABLE_LIST::check_single_table made aware about fact that now if table attached to a merged view it can be (unopened) temporary table
(in 5.2 it was always leaf table or non (in case of several tables)).
This commit is contained in:
unknown
2012-06-26 21:43:34 +03:00
parent 20f3f4a273
commit 1b84c0cfee
3 changed files with 34 additions and 1 deletions

View File

@@ -4472,6 +4472,19 @@ INSERT INTO t2 VALUES (1);
DROP TRIGGER tr;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
#
# LP bug#1007622 Server crashes in handler::increment_statistics on
# inserting into a view over a view
#
CREATE TABLE t1 (a INT);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
INSERT INTO v2 (a) VALUES (1) ;
select * from t1;
a
1
drop view v2,v1;
drop table t1;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------

View File

@@ -4420,6 +4420,19 @@ DROP TRIGGER tr;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
--echo #
--echo # LP bug#1007622 Server crashes in handler::increment_statistics on
--echo # inserting into a view over a view
--echo #
CREATE TABLE t1 (a INT);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
INSERT INTO v2 (a) VALUES (1) ;
select * from t1;
drop view v2,v1;
drop table t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------

View File

@@ -4041,7 +4041,14 @@ bool TABLE_LIST::check_single_table(TABLE_LIST **table_arg,
tbl;
tbl= tbl->next_local)
{
if (tbl->table)
/*
Merged view has also temporary table attached (in 5.2 if it has table
then it was real table), so we have filter such temporary tables out
by checking that it is not merged view
*/
if (tbl->table &&
!(tbl->is_view() &&
tbl->is_merged_derived()))
{
if (tbl->table->map & map)
{