summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-06-26 15:46:36 +0200
committerSergei Golubchik <serg@mariadb.org>2016-06-30 11:43:02 +0200
commit99e48cb1d94e2d884b257b13f792323d3d633322 (patch)
tree0571ed63973349b091a9b306e2dc472254928a60 /mysql-test/t/view.test
parentc87e002bbb946907b4c9504612b3b3c2a0a19e51 (diff)
downloadmariadb-git-99e48cb1d94e2d884b257b13f792323d3d633322.tar.gz
restore ER_VIEW_CHECK_FAILED to be different from ER_CONSTRAINT_FAILED
collaterals: * use %`s, not '%s' * use correct SQLSTATE codes for these two errors
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test50
1 files changed, 25 insertions, 25 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 9086240ade8..e2bc2168385 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1051,7 +1051,7 @@ create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option;
# simple insert
insert into v1 values(1);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v1 values(3);
# simple insert with ignore
insert ignore into v1 values (2),(3),(0);
@@ -1060,7 +1060,7 @@ select * from t1;
delete from t1;
# INSERT SELECT test
insert into v1 SELECT 1;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v1 SELECT 3;
# prepare data for next check
create table t2 (a int);
@@ -1070,7 +1070,7 @@ insert ignore into v1 SELECT a from t2;
select * from t1 order by a desc;
# simple UPDATE test
update v1 set a=-1 where a=0;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
update v1 set a=2 where a=1;
select * from t1 order by a desc;
# prepare data for next check
@@ -1097,12 +1097,12 @@ create view v2 as select * from v1 where a > 0 with local check option;
create view v3 as select * from v1 where a > 0 with cascaded check option;
insert into v2 values (1);
insert into v3 values (1);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v2 values (0);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v3 values (0);
insert into v2 values (2);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v3 values (2);
select * from t1;
drop view v3,v2,v1;
@@ -1114,7 +1114,7 @@ drop table t1;
create table t1 (a int, primary key (a));
create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values (1) on duplicate key update a=2;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v1 values (1) on duplicate key update a=2;
insert ignore into v1 values (1) on duplicate key update a=2;
select * from t1;
@@ -1168,7 +1168,7 @@ select * from t2;
# check it with check option
alter view v2 as select * from t2 where s1 in (select s1 from t1) with check option;
insert into v2 values (5);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
update v2 set s1 = 1;
insert into t1 values (1);
update v2 set s1 = 1;
@@ -1200,7 +1200,7 @@ drop table t1;
create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0 with local check option;
create view v2 as select * from v1 with cascaded check option;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v2 values (0);
drop view v2, v1;
drop table t1;
@@ -1211,7 +1211,7 @@ drop table t1;
create table t1 (s1 int);
create view v1 as select * from t1 where s1 < 5 with check option;
#single value
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert ignore into v1 values (6);
#several values
insert ignore into v1 values (6),(3);
@@ -1225,7 +1225,7 @@ drop table t1;
create table t1 (s1 tinyint);
create trigger t1_bi before insert on t1 for each row set new.s1 = 500;
create view v1 as select * from t1 where s1 <> 127 with check option;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v1 values (0);
select * from v1;
select * from t1;
@@ -1239,7 +1239,7 @@ drop table t1;
create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0;
create view v2 as select * from v1 where s1 <> 1 with cascaded check option;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
insert into v2 values (0);
select * from v2;
select * from t1;
@@ -1252,7 +1252,7 @@ drop table t1;
# fixed length fields
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1;
select * from v1;
@@ -1265,7 +1265,7 @@ drop table t1;
# variable length fields
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
select concat('|',a,'|'), concat('|',b,'|') from v1;
@@ -3017,9 +3017,9 @@ CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNS
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
INSERT INTO v1 (val) VALUES (6);
--- error ER_CONSTRAINT_FAILED
+-- error ER_VIEW_CHECK_FAILED
UPDATE v1 SET val=6 WHERE id=2;
DROP VIEW v1;
DROP TABLE t1;
@@ -3122,7 +3122,7 @@ CREATE VIEW v1 AS
SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
SELECT * FROM v1;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
UPDATE v1 SET b=3;
SELECT * FROM v1;
SELECT * FROM t1;
@@ -3396,14 +3396,14 @@ CREATE VIEW v1 AS
SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3
WITH CHECK OPTION;
SELECT * FROM v1;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
UPDATE v1 SET c=3;
PREPARE t FROM 'UPDATE v1 SET c=3';
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
INSERT INTO v1(a1, c) VALUES (3, 3);
UPDATE v1 SET c=1 WHERE a1=1;
SELECT * FROM v1;
@@ -3414,14 +3414,14 @@ CREATE VIEW v2 AS SELECT t1.a1, t1.c
JOIN (t3 JOIN t4 ON t3.a3=t4.a4)
ON t2.a2=t3.a3 WITH CHECK OPTION;
SELECT * FROM v2;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
UPDATE v2 SET c=3;
PREPARE t FROM 'UPDATE v2 SET c=3';
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error ER_CONSTRAINT_FAILED
+--error ER_VIEW_CHECK_FAILED
INSERT INTO v2(a1, c) VALUES (3, 3);
UPDATE v2 SET c=2 WHERE a1=1;
SELECT * FROM v2;