diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2021-04-06 12:52:44 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2021-04-06 12:52:44 +0200 |
commit | c030f4c625b90baa17cb8c73a018a327aa12b557 (patch) | |
tree | 25466f53c50fc7d92e0b17f04c206f3ccf59eb47 /mysql-test/t/view.test | |
parent | 28b76afceac1eb2c35e77439142daac53908cdc3 (diff) | |
parent | 6fe624b5acf51383d39eb0e547a03779d41cf4a8 (diff) | |
download | mariadb-git-c030f4c625b90baa17cb8c73a018a327aa12b557.tar.gz |
Commit last pull from origin
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r-- | mysql-test/t/view.test | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index cd5cc6efade..8cb00f7a6f4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6492,5 +6492,73 @@ DROP VIEW v1; DROP TABLE t1; --echo # +--echo # MDEV-24314: create view with derived table without default database +--echo # + +drop database test; + +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3),(7),(1); + +create view db1.v1 as select * from (select * from db1.t1) t; +show create view db1.v1; +select * from db1.v1; +drop view db1.v1; + +prepare stmt from " +create view db1.v1 as select * from (select * from db1.t1) t; +"; +execute stmt; +deallocate prepare stmt; +show create view db1.v1; +select * from db1.v1; +drop view db1.v1; + +drop table db1.t1; +drop database db1; + +create database test; +use test; + +--echo # +--echo # MDEV-16940: update of multi-table view returning error used in SP +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2), (3); + +CREATE VIEW v1 AS SELECT a, b FROM t1,t2; + +CREATE PROCEDURE sp1() UPDATE v1 SET a = 8, b = 9; + +--error ER_VIEW_MULTIUPDATE +CALL sp1; +--error ER_VIEW_MULTIUPDATE +CALL sp1; + +DROP PROCEDURE sp1; +DROP VIEW v1; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-23291: SUM column from a derived table returns invalid values +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); + +CREATE view v1 AS +SELECT a as x, (select x) as y, (select y) as z FROM t1; + +SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q; +SELECT sum(z) FROM v1; + +DROP TABLE t1; +DROP VIEW v1; + +--echo # --echo # End of 10.2 tests --echo # |