summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/view.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
commit86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch)
tree28c9e526ea739c6f9b89e36115e1e2698bddf981 /mysql-test/main/view.test
parentReleasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff)
downloadmariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz
mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/view.test')
-rw-r--r--mysql-test/main/view.test53
1 files changed, 53 insertions, 0 deletions
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index a4fe17a8..4c2d71d4 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -6792,3 +6792,56 @@ DROP TABLE t1, t2;
--echo #
--echo # End of 10.6 tests
--echo #
+
+
+--echo #
+--echo # MDEV-29587: Allowing insert into a view with columns that
+--echo # are not part the table
+--echo #
+
+--echo # view with 2 the same fields
+CREATE TABLE table1 (x INT);
+CREATE VIEW view1 AS SELECT x, x as x1 FROM table1;
+INSERT INTO view1(x) VALUES (1);
+INSERT INTO view1(x1) VALUES (1);
+--error ER_NON_INSERTABLE_TABLE
+INSERT INTO view1(x1,x) VALUES (1,1);
+DROP VIEW view1;
+DROP TABLE table1;
+
+--echo # view with a field and expression over the field
+CREATE TABLE table1 (x INT);
+CREATE VIEW view1 AS SELECT x, x + 1 as x1 FROM table1;
+INSERT INTO view1(x) VALUES (1);
+--error ER_NON_INSERTABLE_TABLE
+INSERT INTO view1(x1) VALUES (1);
+--error ER_NON_INSERTABLE_TABLE
+INSERT INTO view1(x1,x) VALUES (1,1);
+DROP VIEW view1;
+DROP TABLE table1;
+
+--echo # view with a field and collation expression over the field
+CREATE TABLE table1 (x char(20));
+CREATE VIEW view1 AS SELECT x, x collate latin1_german1_ci as x1 FROM table1;
+INSERT INTO view1(x) VALUES ("ua");
+--echo # we can insert in the field with collation
+INSERT INTO view1(x1) VALUES ("ua");
+--error ER_NON_INSERTABLE_TABLE
+INSERT INTO view1(x1,x) VALUES ("ua","ua");
+DROP VIEW view1;
+DROP TABLE table1;
+
+--echo # view with a field and expression over other field
+CREATE TABLE table1 (x INT, y INT);
+CREATE VIEW view1 AS SELECT x, y + 1 as x1 FROM table1;
+INSERT INTO view1(x) VALUES (1);
+--error ER_NON_INSERTABLE_TABLE
+INSERT INTO view1(x1) VALUES (1);
+--error ER_NON_INSERTABLE_TABLE
+INSERT INTO view1(x1,x) VALUES (1,1);
+DROP VIEW view1;
+DROP TABLE table1;
+
+--echo #
+--echo # End of 10.11 test
+--echo #