summaryrefslogtreecommitdiff
path: root/mysql-test/t/derived_view.test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-02-01 17:09:49 +0200
committerunknown <sanja@montyprogram.com>2012-02-01 17:09:49 +0200
commitb4643d75fe065d92403817a1dd8785b198b6fdec (patch)
treee4f07d0fbce836002d58021cf33b750b1edf1275 /mysql-test/t/derived_view.test
parent7ed15e6e50aec65560d8988fc5713f1f489b6616 (diff)
downloadmariadb-git-b4643d75fe065d92403817a1dd8785b198b6fdec.tar.gz
fix for LP BUG#921878.
Problem was in try to check/use Item_direct_ref of derived view when we have to use real Item_field under it.
Diffstat (limited to 'mysql-test/t/derived_view.test')
-rw-r--r--mysql-test/t/derived_view.test30
1 files changed, 26 insertions, 4 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index f8ba1f347f3..95412426aa0 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1192,7 +1192,7 @@ INSERT INTO t2 VALUES (7), (4);
CREATE TABLE t1 (b int NOT NULL);
INSERT INTO t1 VALUES (5), (7);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-
+SET @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
PREPARE st1 FROM
@@ -1201,10 +1201,12 @@ EXECUTE st1;
EXECUTE st1;
DEALLOCATE PREPARE st1;
+set SESSION optimizer_switch= @save_optimizer_switch;
+
DROP VIEW v1;
DROP TABLE t1,t2;
-SET SESSION optimizer_switch='derived_merge=on';
+
--echo #
--echo # LP bug #879939: assertion in ha_maria::enable_indexes
@@ -1226,7 +1228,7 @@ INSERT INTO t1 VALUES
CREATE TABLE t3 (a varchar(35));
INSERT INTO t3 VALUES ('Miami');
-
+SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_with_keys=on';
SET @@tmp_table_size=1024*4;
explain SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b;
@@ -1234,7 +1236,7 @@ SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b;
SET @@tmp_table_size=1024*1024*16;
SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b;
SET @@tmp_table_size=default;
-
+set SESSION optimizer_switch= @save_optimizer_switch;
drop table t1,t2,t3;
--echo #
@@ -1291,6 +1293,26 @@ SELECT * FROM (SELECT * FROM t1 LIMIT 3) t;
DROP TABLE t1;
+--echo #
+--echo # LP BUG#921878 incorrect check of items during columns union types
+--echo # aggregation for merged derived tables
+--echo #
+SET @save_optimizer_switch=@@optimizer_switch;
+SET SESSION optimizer_switch='derived_merge=on';
+CREATE TABLE t1 ( a ENUM( 'x', 'y' ) );
+insert into t1 values ('x');
+CREATE TABLE t2 LIKE t1;
+insert into t1 values ('y');
+CREATE TABLE t3 LIKE t1;
+INSERT INTO t3
+ SELECT * FROM ( SELECT * FROM t1 ) AS A
+ UNION SELECT * FROM t2;
+select * from t3;
+
+drop table t1,t2,t3;
+
+set SESSION optimizer_switch= @save_optimizer_switch;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;