Commit 99e48cb1 authored by Sergei Golubchik's avatar Sergei Golubchik

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
parent c87e002b
...@@ -1058,7 +1058,7 @@ SELECT * FROM v1; ...@@ -1058,7 +1058,7 @@ SELECT * FROM v1;
--echo # 1970-01-01 03:33:20 --echo # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234; SET TIMESTAMP = 2000.000234;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE v1 SET a = 2; UPDATE v1 SET a = 2;
SELECT * FROM t1; SELECT * FROM t1;
...@@ -1083,7 +1083,7 @@ SELECT * FROM v1; ...@@ -1083,7 +1083,7 @@ SELECT * FROM v1;
SET TIMESTAMP = 1.126789; SET TIMESTAMP = 1.126789;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
SELECT * FROM v1; SELECT * FROM v1;
......
...@@ -414,12 +414,12 @@ t1 CREATE TABLE `t1` ( ...@@ -414,12 +414,12 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`) UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 42000: Can't DROP 'PRIMARY'; check that constraint/column/key exists ERROR 42000: Can't DROP `PRIMARY`; check that it exists
DROP TABLE t1; DROP TABLE t1;
create table t1 (a int, b int, key(a)); create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2); insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key; alter table t1 drop key no_such_key;
ERROR 42000: Can't DROP 'no_such_key'; check that constraint/column/key exists ERROR 42000: Can't DROP `no_such_key`; check that it exists
alter table t1 drop key a; alter table t1 drop key a;
drop table t1; drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM; CREATE TABLE T12207(a int) ENGINE=MYISAM;
...@@ -1374,7 +1374,7 @@ Note 1060 Duplicate column name 'lol' ...@@ -1374,7 +1374,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol; ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol; ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings: Warnings:
Note 1091 Can't DROP 'lol'; check that constraint/column/key exists Note 1091 Can't DROP `lol`; check that it exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings: Warnings:
...@@ -1385,7 +1385,7 @@ Note 1054 Unknown column 'lol' in 't1' ...@@ -1385,7 +1385,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1; DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1; DROP INDEX IF EXISTS x_param ON t1;
Warnings: Warnings:
Note 1091 Can't DROP 'x_param'; check that constraint/column/key exists Note 1091 Can't DROP `x_param`; check that it exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings: Warnings:
...@@ -1416,7 +1416,7 @@ Note 1060 Duplicate column name 'lol' ...@@ -1416,7 +1416,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol; ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol; ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings: Warnings:
Note 1091 Can't DROP 'lol'; check that constraint/column/key exists Note 1091 Can't DROP `lol`; check that it exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param); ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings: Warnings:
...@@ -1427,7 +1427,7 @@ Note 1054 Unknown column 'lol' in 't1' ...@@ -1427,7 +1427,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1; DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1; DROP INDEX IF EXISTS x_param ON t1;
Warnings: Warnings:
Note 1091 Can't DROP 'x_param'; check that constraint/column/key exists Note 1091 Can't DROP `x_param`; check that it exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param); CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings: Warnings:
...@@ -1447,7 +1447,7 @@ Note 1061 Duplicate key name 'fk' ...@@ -1447,7 +1447,7 @@ Note 1061 Duplicate key name 'fk'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk; ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk; ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
Warnings: Warnings:
Note 1091 Can't DROP 'fk'; check that constraint/column/key exists Note 1091 Can't DROP `fk`; check that it exists
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
...@@ -1461,7 +1461,7 @@ Note 1061 Duplicate key name 't2_ibfk_1' ...@@ -1461,7 +1461,7 @@ Note 1061 Duplicate key name 't2_ibfk_1'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1; ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1; ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
Warnings: Warnings:
Note 1091 Can't DROP 't2_ibfk_1'; check that constraint/column/key exists Note 1091 Can't DROP `t2_ibfk_1`; check that it exists
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
...@@ -1486,10 +1486,10 @@ t2 CREATE TABLE `t2` ( ...@@ -1486,10 +1486,10 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id; ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
Warnings: Warnings:
Note 1091 Can't DROP 'k_id'; check that constraint/column/key exists Note 1091 Can't DROP `k_id`; check that it exists
ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a; ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a;
Warnings: Warnings:
Note 1091 Can't DROP 'a'; check that constraint/column/key exists Note 1091 Can't DROP `a`; check that it exists
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
......
...@@ -10,15 +10,15 @@ t1 CREATE TABLE `t1` ( ...@@ -10,15 +10,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (100,100); insert into t1 values (100,100);
insert into t1 values (1,1); insert into t1 values (1,1);
ERROR HY000: CONSTRAINT 'a' failed for 'test.t1' ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
insert into t1 values (20,1); insert into t1 values (20,1);
ERROR HY000: CONSTRAINT 'b' failed for 'test.t1' ERROR 23000: CONSTRAINT `b` failed for `test`.`t1`
insert into t1 values (20,30); insert into t1 values (20,30);
ERROR HY000: CONSTRAINT 'min' failed for 'test.t1' ERROR 23000: CONSTRAINT `min` failed for `test`.`t1`
insert into t1 values (500,500); insert into t1 values (500,500);
ERROR HY000: CONSTRAINT 'max' failed for 'test.t1' ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
insert into t1 values (101,101),(102,102),(600,600),(103,103); insert into t1 values (101,101),(102,102),(600,600),(103,103);
ERROR HY000: CONSTRAINT 'max' failed for 'test.t1' ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
select * from t1; select * from t1;
a b a b
100 100 100 100
...@@ -27,7 +27,7 @@ a b ...@@ -27,7 +27,7 @@ a b
truncate table t1; truncate table t1;
insert ignore into t1 values (101,101),(102,102),(600,600),(103,103); insert ignore into t1 values (101,101),(102,102),(600,600),(103,103);
Warnings: Warnings:
Warning 1369 CONSTRAINT 'max' failed for 'test.t1' Warning 4016 CONSTRAINT `max` failed for `test`.`t1`
select * from t1; select * from t1;
a b a b
101 101 101 101
...@@ -44,7 +44,7 @@ a b ...@@ -44,7 +44,7 @@ a b
103 103 103 103
set check_constraint_checks=@save_check_constraint; set check_constraint_checks=@save_check_constraint;
alter table t1 add c int default 0 check (c < 10); alter table t1 add c int default 0 check (c < 10);
ERROR HY000: CONSTRAINT 'max' failed for table ERROR 23000: CONSTRAINT `max` failed for table
set check_constraint_checks=0; set check_constraint_checks=0;
alter table t1 add c int default 0 check (c < 10); alter table t1 add c int default 0 check (c < 10);
alter table t1 add check (a+b+c < 500); alter table t1 add check (a+b+c < 500);
...@@ -60,9 +60,9 @@ t1 CREATE TABLE `t1` ( ...@@ -60,9 +60,9 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values(105,105,105); insert into t1 values(105,105,105);
ERROR HY000: CONSTRAINT 'c' failed for 'test.t1' ERROR 23000: CONSTRAINT `c` failed for `test`.`t1`
insert into t1 values(249,249,9); insert into t1 values(249,249,9);
ERROR HY000: CONSTRAINT 'CONSTRAINT_1' failed for 'test.t1' ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
insert into t1 values(105,105,9); insert into t1 values(105,105,9);
select * from t1; select * from t1;
a b c a b c
...@@ -83,7 +83,7 @@ t2 CREATE TABLE `t2` ( ...@@ -83,7 +83,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t2 drop constraint c; alter table t2 drop constraint c;
ERROR 42000: Can't DROP 'c'; check that constraint/column/key exists ERROR 42000: Can't DROP `c`; check that it exists
alter table t2 drop constraint min; alter table t2 drop constraint min;
show create table t2; show create table t2;
Table Create Table Table Create Table
......
...@@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` ( ...@@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (0); insert into t1 values (0);
ERROR HY000: CONSTRAINT 'a' failed for 'test.t1' ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
drop table t1; drop table t1;
create table t1 (a int, b int, check (a>b)); create table t1 (a int, b int, check (a>b));
show create table t1; show create table t1;
...@@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( ...@@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0); insert into t1 values (1,0);
insert into t1 values (0,1); insert into t1 values (0,1);
ERROR HY000: CONSTRAINT 'CONSTRAINT_1' failed for 'test.t1' ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1; drop table t1;
create table t1 (a int ,b int, constraint abc check (a>b)); create table t1 (a int ,b int, constraint abc check (a>b));
show create table t1; show create table t1;
...@@ -31,7 +31,7 @@ t1 CREATE TABLE `t1` ( ...@@ -31,7 +31,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0); insert into t1 values (1,0);
insert into t1 values (0,1); insert into t1 values (0,1);
ERROR HY000: CONSTRAINT 'abc' failed for 'test.t1' ERROR 23000: CONSTRAINT `abc` failed for `test`.`t1`
drop table t1; drop table t1;
create table t1 (a int null); create table t1 (a int null);
show create table t1; show create table t1;
......
...@@ -363,7 +363,7 @@ t1 CREATE TABLE `t1` ( ...@@ -363,7 +363,7 @@ t1 CREATE TABLE `t1` (
DROP INDEX IF EXISTS i1 ON t1; DROP INDEX IF EXISTS i1 ON t1;
DROP INDEX IF EXISTS i1 ON t1; DROP INDEX IF EXISTS i1 ON t1;
Warnings: Warnings:
Note 1091 Can't DROP 'i1'; check that constraint/column/key exists Note 1091 Can't DROP `i1`; check that it exists
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
Warnings: Warnings:
......
...@@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` ( ...@@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP INDEX IF EXISTS i1 ON t1; DROP INDEX IF EXISTS i1 ON t1;
Warnings: Warnings:
Note 1091 Can't DROP 'i1'; check that constraint/column/key exists Note 1091 Can't DROP `i1`; check that it exists
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -1443,7 +1443,7 @@ a b ...@@ -1443,7 +1443,7 @@ a b
# 1970-01-01 03:33:20 # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234; SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2; UPDATE v1 SET a = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1; SELECT * FROM t1;
a b a b
1 1970-01-01 03:16:40 1 1970-01-01 03:16:40
...@@ -1466,7 +1466,7 @@ a c ...@@ -1466,7 +1466,7 @@ a c
1973-08-14 09:11:22 1 1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789; SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1; SELECT * FROM v1;
a c a c
1973-08-14 09:11:22 1 1973-08-14 09:11:22 1
...@@ -2989,7 +2989,7 @@ a b ...@@ -2989,7 +2989,7 @@ a b
# 1970-01-01 03:33:20 # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234; SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2; UPDATE v1 SET a = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1; SELECT * FROM t1;
a b a b
1 1970-01-01 03:16:40.123456 1 1970-01-01 03:16:40.123456
...@@ -3012,7 +3012,7 @@ a c ...@@ -3012,7 +3012,7 @@ a c
1973-08-14 09:11:22.089786 1 1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789; SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1; SELECT * FROM v1;
a c a c
1973-08-14 09:11:22.089786 1 1973-08-14 09:11:22.089786 1
......
...@@ -1444,7 +1444,7 @@ a b ...@@ -1444,7 +1444,7 @@ a b
# 1970-01-01 03:33:20 # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234; SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2; UPDATE v1 SET a = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1; SELECT * FROM t1;
a b a b
1 1970-01-01 03:16:40 1 1970-01-01 03:16:40
...@@ -1467,7 +1467,7 @@ a c ...@@ -1467,7 +1467,7 @@ a c
1973-08-14 09:11:22 1 1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789; SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1; SELECT * FROM v1;
a c a c
1973-08-14 09:11:22 1 1973-08-14 09:11:22 1
...@@ -2990,7 +2990,7 @@ a b ...@@ -2990,7 +2990,7 @@ a b
# 1970-01-01 03:33:20 # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234; SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2; UPDATE v1 SET a = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1; SELECT * FROM t1;
a b a b
1 1970-01-01 03:16:40.123456 1 1970-01-01 03:16:40.123456
...@@ -3013,7 +3013,7 @@ a c ...@@ -3013,7 +3013,7 @@ a c
1973-08-14 09:11:22.089786 1 1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789; SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1; SELECT * FROM v1;
a c a c
1973-08-14 09:11:22.089786 1 1973-08-14 09:11:22.089786 1
......
...@@ -467,7 +467,7 @@ alter table t1 drop index c2, add index (c2(4),c3(7)); ...@@ -467,7 +467,7 @@ alter table t1 drop index c2, add index (c2(4),c3(7));
alter table t1 add primary key (c1, c2), drop primary key; alter table t1 add primary key (c1, c2), drop primary key;
alter table t1 drop primary key; alter table t1 drop primary key;
alter table t1 add primary key (c1, c2), drop primary key; alter table t1 add primary key (c1, c2), drop primary key;
ERROR 42000: Can't DROP 'PRIMARY'; check that constraint/column/key exists ERROR 42000: Can't DROP `PRIMARY`; check that it exists
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -126,7 +126,7 @@ HANDLER_WRITE 2 ...@@ -126,7 +126,7 @@ HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock) # 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS; FLUSH STATUS;
INSERT INTO v1 VALUES (31); INSERT INTO v1 VALUES (31);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
...@@ -135,7 +135,7 @@ HANDLER_TMP_WRITE 22 ...@@ -135,7 +135,7 @@ HANDLER_TMP_WRITE 22
# 2 locks (1 table, all partitions pruned) # 2 locks (1 table, all partitions pruned)
FLUSH STATUS; FLUSH STATUS;
INSERT INTO v1 VALUES (32); INSERT INTO v1 VALUES (32);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
......
...@@ -27,6 +27,6 @@ drop table t1; ...@@ -27,6 +27,6 @@ drop table t1;
CREATE TABLE t1 (f1 INT); CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION; CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
REPLACE INTO v1 (f1) VALUES (1); REPLACE INTO v1 (f1) VALUES (1);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1; DROP VIEW v1;
...@@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1; SELECT * FROM v1;
c c
1 1
......
...@@ -5003,7 +5003,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -5003,7 +5003,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1; SELECT * FROM v1;
c c
1 1
......
...@@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1; SELECT * FROM v1;
c c
1 1
......
...@@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1; SELECT * FROM v1;
c c
1 1
......
...@@ -5007,7 +5007,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -5007,7 +5007,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1; SELECT * FROM v1;
c c
1 1
......
...@@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1; SELECT * FROM v1;
c c
1 1
......
...@@ -253,7 +253,7 @@ drop view v1; ...@@ -253,7 +253,7 @@ drop view v1;
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
create view v1 as select distinct a from t1 WITH CHECK OPTION; create view v1 as select distinct a from t1 WITH CHECK OPTION;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v1' ERROR HY000: CHECK OPTION on non-updatable view `test`.`v1`
create view v1 as select a from t1 WITH CHECK OPTION; create view v1 as select a from t1 WITH CHECK OPTION;
create view v2 as select a from t1 WITH CASCADED CHECK OPTION; create view v2 as select a from t1 WITH CASCADED CHECK OPTION;
create view v3 as select a from t1 WITH LOCAL CHECK OPTION; create view v3 as select a from t1 WITH LOCAL CHECK OPTION;
...@@ -1134,11 +1134,11 @@ create table t1 (a int); ...@@ -1134,11 +1134,11 @@ create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option; create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values(1); insert into v1 values(1);
insert into v1 values(3); insert into v1 values(3);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 values (2),(3),(0); insert ignore into v1 values (2),(3),(0);
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
a a
1 1
...@@ -1146,20 +1146,20 @@ a ...@@ -1146,20 +1146,20 @@ a
delete from t1; delete from t1;
insert into v1 SELECT 1; insert into v1 SELECT 1;
insert into v1 SELECT 3; insert into v1 SELECT 3;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
create table t2 (a int); create table t2 (a int);
insert into t2 values (2),(3),(0); insert into t2 values (2),(3),(0);
insert ignore into v1 SELECT a from t2; insert ignore into v1 SELECT a from t2;
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1 order by a desc; select * from t1 order by a desc;
a a
1 1
0 0
update v1 set a=-1 where a=0; update v1 set a=-1 where a=0;
update v1 set a=2 where a=1; update v1 set a=2 where a=1;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
select * from t1 order by a desc; select * from t1 order by a desc;
a a
1 1
...@@ -1174,7 +1174,7 @@ a ...@@ -1174,7 +1174,7 @@ a
update v1 set a=a+1; update v1 set a=a+1;
update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a; update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
a a
1 1
...@@ -1188,12 +1188,12 @@ create view v3 as select * from v1 where a > 0 with cascaded check option; ...@@ -1188,12 +1188,12 @@ create view v3 as select * from v1 where a > 0 with cascaded check option;
insert into v2 values (1); insert into v2 values (1);
insert into v3 values (1); insert into v3 values (1);
insert into v2 values (0); insert into v2 values (0);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
insert into v3 values (0); insert into v3 values (0);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v3' ERROR 44000: CHECK OPTION failed `test`.`v3`
insert into v2 values (2); insert into v2 values (2);
insert into v3 values (2); insert into v3 values (2);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v3' ERROR 44000: CHECK OPTION failed `test`.`v3`
select * from t1; select * from t1;
a a
1 1
...@@ -1205,10 +1205,10 @@ create table t1 (a int, primary key (a)); ...@@ -1205,10 +1205,10 @@ create table t1 (a int, primary key (a));
create view v1 as select * from t1 where a < 2 with check option; create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values (1) on duplicate key update a=2; insert into v1 values (1) on duplicate key update a=2;
insert into v1 values (1) on duplicate key update a=2; insert into v1 values (1) on duplicate key update a=2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 values (1) on duplicate key update a=2; insert ignore into v1 values (1) on duplicate key update a=2;
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
a a
1 1
...@@ -1263,7 +1263,7 @@ s1 ...@@ -1263,7 +1263,7 @@ s1
alter view v2 as select * from t2 where s1 in (select s1 from t1) 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); insert into v2 values (5);
update v2 set s1 = 1; update v2 set s1 = 1;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
insert into t1 values (1); insert into t1 values (1);
update v2 set s1 = 1; update v2 set s1 = 1;
select * from v2; select * from v2;
...@@ -1300,16 +1300,16 @@ create table t1 (s1 tinyint); ...@@ -1300,16 +1300,16 @@ create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0 with local check option; 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; create view v2 as select * from v1 with cascaded check option;
insert into v2 values (0); insert into v2 values (0);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
drop view v2, v1; drop view v2, v1;
drop table t1; drop table t1;
create table t1 (s1 int); create table t1 (s1 int);
create view v1 as select * from t1 where s1 < 5 with check option; create view v1 as select * from t1 where s1 < 5 with check option;
insert ignore into v1 values (6); insert ignore into v1 values (6);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 values (6),(3); insert ignore into v1 values (6),(3);
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
s1 s1
3 3
...@@ -1319,7 +1319,7 @@ create table t1 (s1 tinyint); ...@@ -1319,7 +1319,7 @@ create table t1 (s1 tinyint);
create trigger t1_bi before insert on t1 for each row set new.s1 = 500; 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; create view v1 as select * from t1 where s1 <> 127 with check option;
insert into v1 values (0); insert into v1 values (0);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
select * from v1; select * from v1;
s1 s1
select * from t1; select * from t1;
...@@ -1331,7 +1331,7 @@ create table t1 (s1 tinyint); ...@@ -1331,7 +1331,7 @@ create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0; create view v1 as select * from t1 where s1 <> 0;
create view v2 as select * from v1 where s1 <> 1 with cascaded check option; create view v2 as select * from v1 where s1 <> 1 with cascaded check option;
insert into v2 values (0); insert into v2 values (0);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
select * from v2; select * from v2;
s1 s1
select * from t1; select * from t1;
...@@ -1341,7 +1341,7 @@ drop table t1; ...@@ -1341,7 +1341,7 @@ drop table t1;
create table t1 (a int, b char(10)); create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option; create view v1 as select * from t1 where a != 0 with check option;
load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
a b a b
1 row 1 1 row 1
...@@ -1356,10 +1356,10 @@ Warnings: ...@@ -1356,10 +1356,10 @@ Warnings:
Note 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2 Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
Note 1265 Data truncated for column 'a' at row 3 Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4 Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1 order by a,b; select * from t1 order by a,b;
a b a b
1 row 1 1 row 1
...@@ -1375,7 +1375,7 @@ drop table t1; ...@@ -1375,7 +1375,7 @@ drop table t1;
create table t1 (a text, b text); create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option; create view v1 as select * from t1 where a <> 'Field A' with check option;
load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
select concat('|',a,'|'), concat('|',b,'|') from t1; select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|') concat('|',a,'|') concat('|',b,'|')
select concat('|',a,'|'), concat('|',b,'|') from v1; select concat('|',a,'|'), concat('|',b,'|') from v1;
...@@ -1383,7 +1383,7 @@ concat('|',a,'|') concat('|',b,'|') ...@@ -1383,7 +1383,7 @@ concat('|',a,'|') concat('|',b,'|')
delete from t1; delete from t1;
load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
Warning 1261 Row 2 doesn't contain data for all columns Warning 1261 Row 2 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1; select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|') concat('|',a,'|') concat('|',b,'|')
...@@ -3047,9 +3047,9 @@ CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK ...@@ -3047,9 +3047,9 @@ CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK
INSERT INTO v1 (val) VALUES (2); INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4); INSERT INTO v1 (val) VALUES (4);
INSERT INTO v1 (val) VALUES (6); INSERT INTO v1 (val) VALUES (6);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
UPDATE v1 SET val=6 WHERE id=2; UPDATE v1 SET val=6 WHERE id=2;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
DROP VIEW IF EXISTS v1, v2; DROP VIEW IF EXISTS v1, v2;
...@@ -3135,7 +3135,7 @@ b ...@@ -3135,7 +3135,7 @@ b
1 1
2 2
UPDATE v1 SET b=3; UPDATE v1 SET b=3;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1; SELECT * FROM v1;
b b
1 1
...@@ -3467,14 +3467,14 @@ a1 c ...@@ -3467,14 +3467,14 @@ a1 c
1 0 1 0
2 0 2 0
UPDATE v1 SET c=3; UPDATE v1 SET c=3;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
PREPARE t FROM 'UPDATE v1 SET c=3'; PREPARE t FROM 'UPDATE v1 SET c=3';
EXECUTE t; EXECUTE t;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
EXECUTE t; EXECUTE t;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
INSERT INTO v1(a1, c) VALUES (3, 3); INSERT INTO v1(a1, c) VALUES (3, 3);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
UPDATE v1 SET c=1 WHERE a1=1; UPDATE v1 SET c=1 WHERE a1=1;
SELECT * FROM v1; SELECT * FROM v1;
a1 c a1 c
...@@ -3493,14 +3493,14 @@ a1 c ...@@ -3493,14 +3493,14 @@ a1 c
1 1 1 1
2 0 2 0
UPDATE v2 SET c=3; UPDATE v2 SET c=3;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
PREPARE t FROM 'UPDATE v2 SET c=3'; PREPARE t FROM 'UPDATE v2 SET c=3';
EXECUTE t; EXECUTE t;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
EXECUTE t; EXECUTE t;
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
INSERT INTO v2(a1, c) VALUES (3, 3); INSERT INTO v2(a1, c) VALUES (3, 3);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2' ERROR 44000: CHECK OPTION failed `test`.`v2`
UPDATE v2 SET c=2 WHERE a1=1; UPDATE v2 SET c=2 WHERE a1=1;
SELECT * FROM v2; SELECT * FROM v2;
a1 c a1 c
...@@ -4746,13 +4746,13 @@ drop view if exists v_9801; ...@@ -4746,13 +4746,13 @@ drop view if exists v_9801;
create table t_9801 (s1 int); create table t_9801 (s1 int);
create view v_9801 as create view v_9801 as
select sum(s1) from t_9801 with check option; select sum(s1) from t_9801 with check option;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801' ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_9801`
create view v_9801 as create view v_9801 as
select sum(s1) from t_9801 group by s1 with check option; select sum(s1) from t_9801 group by s1 with check option;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801' ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_9801`
create view v_9801 as create view v_9801 as
select sum(s1) from t_9801 group by s1 with rollup with check option; select sum(s1) from t_9801 group by s1 with rollup with check option;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801' ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_9801`
drop table t_9801; drop table t_9801;
# #
# Bug #47335 assert in get_table_share # Bug #47335 assert in get_table_share
......
...@@ -60,7 +60,7 @@ INSERT INTO processlist SELECT * FROM test.t_processlist; ...@@ -60,7 +60,7 @@ INSERT INTO processlist SELECT * FROM test.t_processlist;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP TABLE test.t_processlist; DROP TABLE test.t_processlist;
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist WITH CHECK OPTION; CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist WITH CHECK OPTION;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist' ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_processlist`
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist; CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist;
DROP VIEW test.v_processlist; DROP VIEW test.v_processlist;
UPDATE processlist SET user='any_user' WHERE id=1 ; UPDATE processlist SET user='any_user' WHERE id=1 ;
...@@ -136,7 +136,7 @@ INSERT INTO processlist SELECT * FROM test.t_processlist; ...@@ -136,7 +136,7 @@ INSERT INTO processlist SELECT * FROM test.t_processlist;
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
DROP TABLE test.t_processlist; DROP TABLE test.t_processlist;
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist WITH CHECK OPTION; CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist WITH CHECK OPTION;
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist' ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_processlist`
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist; CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY) AS SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, STAGE, MAX_STAGE, PROGRESS, MEMORY_USED, EXAMINED_ROWS, QUERY_ID, INFO_BINARY FROM processlist;
DROP VIEW test.v_processlist; DROP VIEW test.v_processlist;
UPDATE processlist SET user='any_user' WHERE id=1 ; UPDATE processlist SET user='any_user' WHERE id=1 ;
......
...@@ -1838,7 +1838,7 @@ Drop view if exists test.v1 ; ...@@ -1838,7 +1838,7 @@ Drop view if exists test.v1 ;
CREATE VIEW test.v1 AS SELECT f59,f60 CREATE VIEW test.v1 AS SELECT f59,f60
FROM test.tb2 where f59 = 195 WITH CHECK OPTION ; FROM test.tb2 where f59 = 195 WITH CHECK OPTION ;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE test.v1 SET f59 = 198 where f59=195 ; UPDATE test.v1 SET f59 = 198 where f59=195 ;
SELECT * FROM test.v1 order by f59 ; SELECT * FROM test.v1 order by f59 ;
...@@ -1863,7 +1863,7 @@ FROM test.tb2 where F59 = 0987 WITH LOCAL CHECK OPTION ; ...@@ -1863,7 +1863,7 @@ FROM test.tb2 where F59 = 0987 WITH LOCAL CHECK OPTION ;
CREATE VIEW test.v2 as SELECT * FROM test.v1 ; CREATE VIEW test.v2 as SELECT * FROM test.v1 ;
# This UPDATE violates the definition of VIEW test.v1. # This UPDATE violates the definition of VIEW test.v1.
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE test.v1 SET F59 = 919 where f59 = 0987 ; UPDATE test.v1 SET F59 = 919 where f59 = 0987 ;
SELECT * FROM test.v1 order by f59 ; SELECT * FROM test.v1 order by f59 ;
...@@ -1909,9 +1909,9 @@ INSERT INTO v1 VALUES('B',2); ...@@ -1909,9 +1909,9 @@ INSERT INTO v1 VALUES('B',2);
SELECT * FROM v1 order by f1, f2; SELECT * FROM v1 order by f1, f2;
# negative cases # negative cases
--enable_info --enable_info
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE v1 SET f2 = 4; UPDATE v1 SET f2 = 4;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v1 VALUES('B',3); INSERT INTO v1 VALUES('B',3);
--disable_info --disable_info
# Bug#11771: View over InnoDB table, wrong result SELECT on VIEW, # Bug#11771: View over InnoDB table, wrong result SELECT on VIEW,
...@@ -2292,7 +2292,7 @@ WHERE v3_to_v1_options LIKE 'WITH %' AND v3_to_v1_options NOT LIKE 'WITH LOCAL % ...@@ -2292,7 +2292,7 @@ WHERE v3_to_v1_options LIKE 'WITH %' AND v3_to_v1_options NOT LIKE 'WITH LOCAL %
AND v3_to_v1_violation NOT LIKE ' _ _ ' AND errno = 0 AND v3_to_v1_violation NOT LIKE ' _ _ ' AND errno = 0
ORDER BY v3_to_v1_options; ORDER BY v3_to_v1_options;
# 5. There must be NO failing INSERT/UPDATE getting a # 5. There must be NO failing INSERT/UPDATE getting a
# sql_errno <> 1369 (ER_CONSTRAINT_FAILED). # sql_errno <> 1369 (ER_VIEW_CHECK_FAILED).
SELECT * FROM t1_results SELECT * FROM t1_results
WHERE errno <> 0 AND errno <> 1369 WHERE errno <> 0 AND errno <> 1369
ORDER BY v3_to_v1_options; ORDER BY v3_to_v1_options;
......
...@@ -544,9 +544,9 @@ t2 CREATE TABLE `t2` ( ...@@ -544,9 +544,9 @@ t2 CREATE TABLE `t2` (
delete from t1; delete from t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
drop index dc on t4; drop index dc on t4;
ERROR 42000: Can't DROP 'dc'; check that constraint/column/key exists ERROR 42000: Can't DROP `dc`; check that it exists
alter table t3 drop foreign key dc; alter table t3 drop foreign key dc;
ERROR 42000: Can't DROP 'dc'; check that constraint/column/key exists ERROR 42000: Can't DROP `dc`; check that it exists
alter table t4 drop foreign key dc; alter table t4 drop foreign key dc;
affected rows: 0 affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 0 Duplicates: 0 Warnings: 0
......
...@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6 ...@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6
************ ************
connection slave; connection slave;
include/wait_for_slave_sql_error.inc [errno=1091] include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that constraint/column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' Last_SQL_Error = 'Error 'Can't DROP `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
......
...@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6 ...@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6
************ ************
connection slave; connection slave;
include/wait_for_slave_sql_error.inc [errno=1091] include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that constraint/column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' Last_SQL_Error = 'Error 'Can't DROP `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
......
...@@ -270,11 +270,11 @@ c int as (-a) persistent); ...@@ -270,11 +270,11 @@ c int as (-a) persistent);
create view v1 as select * from t1 where b > -2 && c >-2 with check option; create view v1 as select * from t1 where b > -2 && c >-2 with check option;
insert into v1 (a) values (1); insert into v1 (a) values (1);
insert into v1 (a) values (3); insert into v1 (a) values (3);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 (a) values (2),(3),(0); insert ignore into v1 (a) values (2),(3),(0);
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
......
...@@ -270,11 +270,11 @@ c int as (-a) persistent); ...@@ -270,11 +270,11 @@ c int as (-a) persistent);
create view v1 as select * from t1 where b > -2 && c >-2 with check option; create view v1 as select * from t1 where b > -2 && c >-2 with check option;
insert into v1 (a) values (1); insert into v1 (a) values (1);
insert into v1 (a) values (3); insert into v1 (a) values (3);
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 (a) values (2),(3),(0); insert ignore into v1 (a) values (2),(3),(0);
Warnings: Warnings:
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1' Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
......
...@@ -68,12 +68,12 @@ INSERT INTO v1 VALUES (30); ...@@ -68,12 +68,12 @@ INSERT INTO v1 VALUES (30);
eval $get_handler_status_counts; eval $get_handler_status_counts;
--echo # 4 locks (1 table, 1 partition lock/unlock) --echo # 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS; FLUSH STATUS;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v1 VALUES (31); INSERT INTO v1 VALUES (31);
eval $get_handler_status_counts; eval $get_handler_status_counts;
--echo # 2 locks (1 table, all partitions pruned) --echo # 2 locks (1 table, all partitions pruned)
FLUSH STATUS; FLUSH STATUS;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v1 VALUES (32); INSERT INTO v1 VALUES (32);
eval $get_handler_status_counts; eval $get_handler_status_counts;
--echo # 4 locks (1 table, 1 partition lock/unlock) --echo # 4 locks (1 table, 1 partition lock/unlock)
......
...@@ -4129,7 +4129,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -4129,7 +4129,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
# disabled for now as this refers to old content of t2 # disabled for now as this refers to old content of t2
......
...@@ -1051,7 +1051,7 @@ create table t1 (a int); ...@@ -1051,7 +1051,7 @@ create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option; create view v1 as select * from t1 where a < 2 with check option;
# simple insert # simple insert
insert into v1 values(1); insert into v1 values(1);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
insert into v1 values(3); insert into v1 values(3);
# simple insert with ignore # simple insert with ignore
insert ignore into v1 values (2),(3),(0); insert ignore into v1 values (2),(3),(0);
...@@ -1060,7 +1060,7 @@ select * from t1; ...@@ -1060,7 +1060,7 @@ select * from t1;
delete from t1; delete from t1;
# INSERT SELECT test # INSERT SELECT test
insert into v1 SELECT 1; insert into v1 SELECT 1;
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
insert into v1 SELECT 3; insert into v1 SELECT 3;
# prepare data for next check # prepare data for next check
create table t2 (a int); create table t2 (a int);
...@@ -1070,7 +1070,7 @@ insert ignore into v1 SELECT a from t2; ...@@ -1070,7 +1070,7 @@ insert ignore into v1 SELECT a from t2;
select * from t1 order by a desc; select * from t1 order by a desc;
# simple UPDATE test # simple UPDATE test
update v1 set a=-1 where a=0; 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; update v1 set a=2 where a=1;
select * from t1 order by a desc; select * from t1 order by a desc;
# prepare data for next check # prepare data for next check
...@@ -1097,12 +1097,12 @@ create view v2 as select * from v1 where a > 0 with local check option; ...@@ -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; create view v3 as select * from v1 where a > 0 with cascaded check option;
insert into v2 values (1); insert into v2 values (1);
insert into v3 values (1); insert into v3 values (1);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
insert into v2 values (0); insert into v2 values (0);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
insert into v3 values (0); insert into v3 values (0);
insert into v2 values (2); insert into v2 values (2);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
insert into v3 values (2); insert into v3 values (2);
select * from t1; select * from t1;
drop view v3,v2,v1; drop view v3,v2,v1;
...@@ -1114,7 +1114,7 @@ drop table t1; ...@@ -1114,7 +1114,7 @@ drop table t1;
create table t1 (a int, primary key (a)); create table t1 (a int, primary key (a));
create view v1 as select * from t1 where a < 2 with check option; create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values (1) on duplicate key update a=2; 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 into v1 values (1) on duplicate key update a=2;
insert ignore 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; select * from t1;
...@@ -1168,7 +1168,7 @@ select * from t2; ...@@ -1168,7 +1168,7 @@ select * from t2;
# check it with check option # check it with check option
alter view v2 as select * from t2 where s1 in (select s1 from t1) 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); insert into v2 values (5);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
update v2 set s1 = 1; update v2 set s1 = 1;
insert into t1 values (1); insert into t1 values (1);
update v2 set s1 = 1; update v2 set s1 = 1;
...@@ -1200,7 +1200,7 @@ drop table t1; ...@@ -1200,7 +1200,7 @@ drop table t1;
create table t1 (s1 tinyint); create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0 with local check option; 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; 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); insert into v2 values (0);
drop view v2, v1; drop view v2, v1;
drop table t1; drop table t1;
...@@ -1211,7 +1211,7 @@ drop table t1; ...@@ -1211,7 +1211,7 @@ drop table t1;
create table t1 (s1 int); create table t1 (s1 int);
create view v1 as select * from t1 where s1 < 5 with check option; create view v1 as select * from t1 where s1 < 5 with check option;
#single value #single value
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
insert ignore into v1 values (6); insert ignore into v1 values (6);
#several values #several values
insert ignore into v1 values (6),(3); insert ignore into v1 values (6),(3);
...@@ -1225,7 +1225,7 @@ drop table t1; ...@@ -1225,7 +1225,7 @@ drop table t1;
create table t1 (s1 tinyint); create table t1 (s1 tinyint);
create trigger t1_bi before insert on t1 for each row set new.s1 = 500; 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; 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); insert into v1 values (0);
select * from v1; select * from v1;
select * from t1; select * from t1;
...@@ -1239,7 +1239,7 @@ drop table t1; ...@@ -1239,7 +1239,7 @@ drop table t1;
create table t1 (s1 tinyint); create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0; create view v1 as select * from t1 where s1 <> 0;
create view v2 as select * from v1 where s1 <> 1 with cascaded check option; 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); insert into v2 values (0);
select * from v2; select * from v2;
select * from t1; select * from t1;
...@@ -1252,7 +1252,7 @@ drop table t1; ...@@ -1252,7 +1252,7 @@ drop table t1;
# fixed length fields # fixed length fields
create table t1 (a int, b char(10)); create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option; 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; load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1; select * from t1;
select * from v1; select * from v1;
...@@ -1265,7 +1265,7 @@ drop table t1; ...@@ -1265,7 +1265,7 @@ drop table t1;
# variable length fields # variable length fields
create table t1 (a text, b text); create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option; 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 ''''; 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 t1;
select concat('|',a,'|'), concat('|',b,'|') from v1; 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 ...@@ -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; 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 (2);
INSERT INTO v1 (val) VALUES (4); INSERT INTO v1 (val) VALUES (4);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
INSERT INTO v1 (val) VALUES (6); INSERT INTO v1 (val) VALUES (6);
-- error ER_CONSTRAINT_FAILED -- error ER_VIEW_CHECK_FAILED
UPDATE v1 SET val=6 WHERE id=2; UPDATE v1 SET val=6 WHERE id=2;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
...@@ -3122,7 +3122,7 @@ CREATE VIEW v1 AS ...@@ -3122,7 +3122,7 @@ CREATE VIEW v1 AS
SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION; SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
SELECT * FROM v1; SELECT * FROM v1;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE v1 SET b=3; UPDATE v1 SET b=3;
SELECT * FROM v1; SELECT * FROM v1;
SELECT * FROM t1; SELECT * FROM t1;
...@@ -3396,14 +3396,14 @@ CREATE VIEW v1 AS ...@@ -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 SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3
WITH CHECK OPTION; WITH CHECK OPTION;
SELECT * FROM v1; SELECT * FROM v1;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE v1 SET c=3; UPDATE v1 SET c=3;
PREPARE t FROM 'UPDATE v1 SET c=3'; PREPARE t FROM 'UPDATE v1 SET c=3';
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
EXECUTE t; EXECUTE t;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
EXECUTE t; EXECUTE t;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v1(a1, c) VALUES (3, 3); INSERT INTO v1(a1, c) VALUES (3, 3);
UPDATE v1 SET c=1 WHERE a1=1; UPDATE v1 SET c=1 WHERE a1=1;
SELECT * FROM v1; SELECT * FROM v1;
...@@ -3414,14 +3414,14 @@ CREATE VIEW v2 AS SELECT t1.a1, t1.c ...@@ -3414,14 +3414,14 @@ CREATE VIEW v2 AS SELECT t1.a1, t1.c
JOIN (t3 JOIN t4 ON t3.a3=t4.a4) JOIN (t3 JOIN t4 ON t3.a3=t4.a4)
ON t2.a2=t3.a3 WITH CHECK OPTION; ON t2.a2=t3.a3 WITH CHECK OPTION;
SELECT * FROM v2; SELECT * FROM v2;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
UPDATE v2 SET c=3; UPDATE v2 SET c=3;
PREPARE t FROM 'UPDATE v2 SET c=3'; PREPARE t FROM 'UPDATE v2 SET c=3';
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
EXECUTE t; EXECUTE t;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
EXECUTE t; EXECUTE t;
--error ER_CONSTRAINT_FAILED --error ER_VIEW_CHECK_FAILED
INSERT INTO v2(a1, c) VALUES (3, 3); INSERT INTO v2(a1, c) VALUES (3, 3);
UPDATE v2 SET c=2 WHERE a1=1; UPDATE v2 SET c=2 WHERE a1=1;
SELECT * FROM v2; SELECT * FROM v2;
......
...@@ -2071,29 +2071,29 @@ ER_CANT_REMOVE_ALL_FIELDS 42000 ...@@ -2071,29 +2071,29 @@ ER_CANT_REMOVE_ALL_FIELDS 42000
swe "Man kan inte radera alla fält med ALTER TABLE. Använd DROP TABLE istället" swe "Man kan inte radera alla fält med ALTER TABLE. Använd DROP TABLE istället"
ukr "Не можливо видалити всі стовбці за допомогою ALTER TABLE. Для цього скористайтеся DROP TABLE" ukr "Не можливо видалити всі стовбці за допомогою ALTER TABLE. Для цього скористайтеся DROP TABLE"
ER_CANT_DROP_FIELD_OR_KEY 42000 ER_CANT_DROP_FIELD_OR_KEY 42000
cze "Nemohu zrušit '%-.192s' (provést DROP). Zkontrolujte, zda neexistují záznamy/klíče" cze "Nemohu zrušit %`-.192s (provést DROP). Zkontrolujte, zda neexistují záznamy/klíče"
dan "Kan ikke udføre DROP '%-.192s'. Undersøg om feltet/nøglen eksisterer." dan "Kan ikke udføre DROP %`-.192s. Undersøg om feltet/nøglen eksisterer."
nla "Kan '%-.192s' niet weggooien. Controleer of het veld of de zoeksleutel daadwerkelijk bestaat." nla "Kan %`-.192s niet weggooien. Controleer of het veld of de zoeksleutel daadwerkelijk bestaat."
eng "Can't DROP '%-.192s'; check that constraint/column/key exists" eng "Can't DROP %`-.192s; check that it exists"
est "Ei suuda kustutada '%-.192s'. Kontrolli kas tulp/võti eksisteerib" est "Ei suuda kustutada %`-.192s. Kontrolli kas tulp/võti eksisteerib"
fre "Ne peut effacer (DROP) '%-.192s'. Vérifiez s'il existe" fre "Ne peut effacer (DROP) %`-.192s. Vérifiez s'il existe"
ger "Kann '%-.192s' nicht löschen. Existiert die Spalte oder der Schlüssel?" ger "Kann %`-.192s nicht löschen. Existiert es?"
greek "Αδύνατη η διαγραφή (DROP) '%-.192s'. Παρακαλώ ελέγξτε αν το πεδίο/κλειδί υπάρχει" greek "Αδύνατη η διαγραφή (DROP) %`-.192s. Παρακαλώ ελέγξτε αν το πεδίο/κλειδί υπάρχει"
hun "A DROP '%-.192s' nem lehetseges. Ellenorizze, hogy a mezo/kulcs letezik-e" hun "A DROP %`-.192s nem lehetseges. Ellenorizze, hogy a mezo/kulcs letezik-e"
ita "Impossibile cancellare '%-.192s'. Controllare che il campo chiave esista" ita "Impossibile cancellare %`-.192s. Controllare che il campo chiave esista"
jpn "'%-.192s' を削除できません。列/索引の存在を確認して下さい。" jpn "%`-.192s を削除できません。列/索引の存在を確認して下さい。"
kor "'%-.192s'를 DROP할 수 없습니다. 칼럼이나 키가 존재하는지 채크하세요." kor "%`-.192s를 DROP할 수 없습니다. 칼럼이나 키가 존재하는지 채크하세요."
nor "Kan ikke DROP '%-.192s'. Undersøk om felt/nøkkel eksisterer." nor "Kan ikke DROP %`-.192s. Undersøk om felt/nøkkel eksisterer."
norwegian-ny "Kan ikkje DROP '%-.192s'. Undersøk om felt/nøkkel eksisterar." norwegian-ny "Kan ikkje DROP %`-.192s. Undersøk om felt/nøkkel eksisterar."
pol "Nie można wykonać operacji DROP '%-.192s'. SprawdĽ, czy to pole/klucz istnieje" pol "Nie można wykonać operacji DROP %`-.192s. SprawdĽ, czy to pole/klucz istnieje"
por "Não se pode fazer DROP '%-.192s'. Confira se esta coluna/chave existe" por "Não se pode fazer DROP %`-.192s. Confira se esta coluna/chave existe"
rum "Nu pot sa DROP '%-.192s'. Verifica daca coloana/cheia exista" rum "Nu pot sa DROP %`-.192s. Verifica daca coloana/cheia exista"
rus "Невозможно удалить (DROP) '%-.192s'. Убедитесь что столбец/ключ действительно существует" rus "Невозможно удалить (DROP) %`-.192s. Убедитесь что он действительно существует"
serbian "Ne mogu da izvršim komandu drop 'DROP' na '%-.192s'. Proverite da li ta kolona (odnosno ključ) postoji" serbian "Ne mogu da izvršim komandu drop 'DROP' na %`-.192s. Proverite da li ta kolona (odnosno ključ) postoji"
slo "Nemôžem zrušiť (DROP) '%-.192s'. Skontrolujte, či neexistujú záznamy/kľúče" slo "Nemôžem zrušiť (DROP) %`-.192s. Skontrolujte, či neexistujú záznamy/kľúče"
spa "No puedo ELIMINAR '%-.192s'. compuebe que el campo/clave existe" spa "No puedo ELIMINAR %`-.192s. compuebe que el campo/clave existe"
swe "Kan inte ta bort '%-.192s'. Kontrollera att begränsningen/fältet/nyckel finns" swe "Kan inte ta bort %`-.192s. Kontrollera att begränsningen/fältet/nyckel finns"
ukr "Не можу DROP '%-.192s'. Перевірте, чи цей стовбець/ключ існує" ukr "Не можу DROP %`-.192s. Перевірте, чи він існує"
ER_INSERT_INFO ER_INSERT_INFO
cze "Záznamů: %ld Zdvojených: %ld Varování: %ld" cze "Záznamů: %ld Zdvojených: %ld Varování: %ld"
dan "Poster: %ld Ens: %ld Advarsler: %ld" dan "Poster: %ld Ens: %ld Advarsler: %ld"
...@@ -5286,15 +5286,15 @@ ER_ILLEGAL_VALUE_FOR_TYPE 22007 ...@@ -5286,15 +5286,15 @@ ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing" eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zulässiger %s-Wert '%-.192s' beim Parsen gefunden" ger "Nicht zulässiger %s-Wert '%-.192s' beim Parsen gefunden"
ER_VIEW_NONUPD_CHECK ER_VIEW_NONUPD_CHECK
eng "CHECK OPTION on non-updatable view '%-.192s.%-.192s'" eng "CHECK OPTION on non-updatable view %`-.192s.%`-.192s"
ger "CHECK OPTION auf nicht-aktualisierbarem View '%-.192s.%-.192s'" ger "CHECK OPTION auf nicht-aktualisierbarem View %`-.192s.%`-.192s"
rus "CHECK OPTION для необновляемого VIEW '%-.192s.%-.192s'" rus "CHECK OPTION для необновляемого VIEW %`-.192s.%`-.192s"
ukr "CHECK OPTION для VIEW '%-.192s.%-.192s' що не може бути оновленним" ukr "CHECK OPTION для VIEW %`-.192s.%`-.192s що не може бути оновленним"
ER_CONSTRAINT_FAILED ER_VIEW_CHECK_FAILED 44000
eng "CONSTRAINT '%s' failed for '%-.192s.%-.192s'" eng "CHECK OPTION failed %`-.192s.%`-.192s"
ger "CONSTRAINT '%s' fehlgeschlagen: '%-.192s.%-.192s'" ger "CHECK OPTION fehlgeschlagen: %`-.192s.%`-.192s"
rus "проверка CONSTRAINT '%s' для '%-.192s.%-.192s' провалилась" rus "Проверка CHECK OPTION для VIEW %`-.192s.%`-.192s провалилась"
ukr "Перевірка CONSTRAINT '%s' для '%-.192s.%-.192s' не пройшла" ukr "Перевірка CHECK OPTION для VIEW %`-.192s.%`-.192s не пройшла"
ER_PROCACCESS_DENIED_ERROR 42000 ER_PROCACCESS_DENIED_ERROR 42000
eng "%-.32s command denied to user '%s'@'%s' for routine '%-.192s'" eng "%-.32s command denied to user '%s'@'%s' for routine '%-.192s'"
ger "Befehl %-.32s nicht zulässig für Benutzer '%s'@'%s' in Routine '%-.192s'" ger "Befehl %-.32s nicht zulässig für Benutzer '%s'@'%s' in Routine '%-.192s'"
...@@ -7203,6 +7203,11 @@ ER_WINDOW_FUNCTION_DONT_HAVE_FRAME ...@@ -7203,6 +7203,11 @@ ER_WINDOW_FUNCTION_DONT_HAVE_FRAME
eng "This window function may not have a window frame" eng "This window function may not have a window frame"
ER_INVALID_NTILE_ARGUMENT ER_INVALID_NTILE_ARGUMENT
eng "Argument of NTILE must be greater than 0" eng "Argument of NTILE must be greater than 0"
ER_CONSTRAINT_FAILED 23000
eng "CONSTRAINT %`s failed for %`-.192s.%`-.192s"
ger "CONSTRAINT %`s fehlgeschlagen: %`-.192s.%`-.192s"
rus "проверка CONSTRAINT %`s для %`-.192s.%`-.192s провалилась"
ukr "Перевірка CONSTRAINT %`s для %`-.192s.%`-.192s не пройшла"
ER_EXPRESSION_IS_TOO_BIG ER_EXPRESSION_IS_TOO_BIG
eng "%s expression is too big for '%s'" eng "%s expression is too big for '%s'"
ER_ERROR_EVALUATING_EXPRESSION ER_ERROR_EVALUATING_EXPRESSION
......
...@@ -4973,26 +4973,6 @@ void TABLE_LIST::cleanup_items() ...@@ -4973,26 +4973,6 @@ void TABLE_LIST::cleanup_items()
} }
static int check_constraint_error(THD *thd, const char *db_name,
const char *table_name,
const LEX_STRING *constraint_name,
bool ignore_failure)
{
if (ignore_failure)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CONSTRAINT_FAILED,
ER_THD(thd, ER_CONSTRAINT_FAILED),
constraint_name->str ? constraint_name->str : "",
db_name, table_name);
return(VIEW_CHECK_SKIP);
}
my_error(ER_CONSTRAINT_FAILED, MYF(0),
constraint_name->str ? constraint_name->str : "",
db_name, table_name);
return VIEW_CHECK_ERROR;
}
/* /*
check CHECK OPTION condition both for view and underlying table check CHECK OPTION condition both for view and underlying table
...@@ -5019,8 +4999,9 @@ int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure) ...@@ -5019,8 +4999,9 @@ int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure)
main_view->db); main_view->db);
const char *name_table= (main_view->view ? main_view->view_name.str : const char *name_table= (main_view->view ? main_view->view_name.str :
main_view->table_name); main_view->table_name);
return check_constraint_error(thd, name_db, name_table, &view_check_name, my_error(ER_VIEW_CHECK_FAILED, MYF(ignore_failure ? ME_JUST_WARNING : 0),
ignore_failure); name_db, name_table);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
} }
return table->verify_constraints(ignore_failure); return table->verify_constraints(ignore_failure);
} }
...@@ -5036,11 +5017,10 @@ int TABLE::verify_constraints(bool ignore_failure) ...@@ -5036,11 +5017,10 @@ int TABLE::verify_constraints(bool ignore_failure)
{ {
if ((*chk)->expr_item->val_int() == 0) if ((*chk)->expr_item->val_int() == 0)
{ {
return check_constraint_error(in_use, my_error(ER_CONSTRAINT_FAILED,
s->db.str, MYF(ignore_failure ? ME_JUST_WARNING : 0), (*chk)->name.str,
s->table_name.str, s->db.str, s->table_name.str);
&(*chk)->name, return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
ignore_failure);
} }
} }
} }
......
...@@ -19,7 +19,7 @@ SELECT * FROM t1 WHERE i = 5; ...@@ -19,7 +19,7 @@ SELECT * FROM t1 WHERE i = 5;
i i
5 5
ALTER TABLE t1 DROP INDEX i; ALTER TABLE t1 DROP INDEX i;
ERROR 42000: Can't DROP 'i'; check that constraint/column/key exists ERROR 42000: Can't DROP `i`; check that it exists
DROP INDEX i ON t1; DROP INDEX i ON t1;
ERROR 42000: Can't DROP 'i'; check that constraint/column/key exists ERROR 42000: Can't DROP `i`; check that it exists
DROP TABLE t1; DROP TABLE t1;
...@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6 ...@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6
************ ************
connection slave; connection slave;
include/wait_for_slave_sql_error.inc [errno=1091] include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that constraint/column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'' Last_SQL_Error = 'Error 'Can't DROP `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment