Skip to content

Commit

Permalink
restore ER_VIEW_CHECK_FAILED to be different from ER_CONSTRAINT_FAILED
Browse files Browse the repository at this point in the history
collaterals:
* use %`s, not '%s'
* use correct SQLSTATE codes for these two errors
  • Loading branch information
vuvova committed Jun 30, 2016
1 parent c87e002 commit 99e48cb
Show file tree
Hide file tree
Showing 35 changed files with 860 additions and 875 deletions.
4 changes: 2 additions & 2 deletions mysql-test/include/function_defaults.inc
Expand Up @@ -1058,7 +1058,7 @@ SELECT * FROM v1;
--echo # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;

--error ER_CONSTRAINT_FAILED
--error ER_VIEW_CHECK_FAILED
UPDATE v1 SET a = 2;
SELECT * FROM t1;

Expand All @@ -1083,7 +1083,7 @@ SELECT * FROM v1;

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;

SELECT * FROM v1;
Expand Down
20 changes: 10 additions & 10 deletions mysql-test/r/alter_table.result
Expand Up @@ -414,12 +414,12 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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;
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
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;
drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM;
Expand Down Expand Up @@ -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;
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);
Warnings:
Expand All @@ -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;
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);
Warnings:
Expand Down Expand Up @@ -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;
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);
Warnings:
Expand All @@ -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;
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);
Warnings:
Expand All @@ -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;
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;
Table Create Table
t2 CREATE TABLE `t2` (
Expand All @@ -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;
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;
Table Create Table
t2 CREATE TABLE `t2` (
Expand All @@ -1486,10 +1486,10 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
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;
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;
Table Create Table
t2 CREATE TABLE `t2` (
Expand Down
20 changes: 10 additions & 10 deletions mysql-test/r/check_constraint.result
Expand Up @@ -10,15 +10,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (100,100);
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);
ERROR HY000: CONSTRAINT 'b' failed for 'test.t1'
ERROR 23000: CONSTRAINT `b` failed for `test`.`t1`
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);
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);
ERROR HY000: CONSTRAINT 'max' failed for 'test.t1'
ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
select * from t1;
a b
100 100
Expand All @@ -27,7 +27,7 @@ a b
truncate table t1;
insert ignore into t1 values (101,101),(102,102),(600,600),(103,103);
Warnings:
Warning 1369 CONSTRAINT 'max' failed for 'test.t1'
Warning 4016 CONSTRAINT `max` failed for `test`.`t1`
select * from t1;
a b
101 101
Expand All @@ -44,7 +44,7 @@ a b
103 103
set check_constraint_checks=@save_check_constraint;
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;
alter table t1 add c int default 0 check (c < 10);
alter table t1 add check (a+b+c < 500);
Expand All @@ -60,9 +60,9 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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);
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);
select * from t1;
a b c
Expand All @@ -83,7 +83,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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;
show create table t2;
Table Create Table
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/r/constraints.result
Expand Up @@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1);
insert into t1 values (0);
ERROR HY000: CONSTRAINT 'a' failed for 'test.t1'
ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
drop table t1;
create table t1 (a int, b int, check (a>b));
show create table t1;
Expand All @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
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;
create table t1 (a int ,b int, constraint abc check (a>b));
show create table t1;
Expand All @@ -31,7 +31,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
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;
create table t1 (a int null);
show create table t1;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/create_drop_binlog.result
Expand Up @@ -363,7 +363,7 @@ t1 CREATE TABLE `t1` (
DROP INDEX IF EXISTS i1 ON t1;
DROP INDEX IF EXISTS i1 ON t1;
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 IF EXISTS t1;
Warnings:
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/create_drop_index.result
Expand Up @@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP INDEX IF EXISTS i1 ON t1;
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;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/r/function_defaults.result
Expand Up @@ -1443,7 +1443,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
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;
a b
1 1970-01-01 03:16:40
Expand All @@ -1466,7 +1466,7 @@ a c
1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789;
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;
a c
1973-08-14 09:11:22 1
Expand Down Expand Up @@ -2989,7 +2989,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
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;
a b
1 1970-01-01 03:16:40.123456
Expand All @@ -3012,7 +3012,7 @@ a c
1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789;
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;
a c
1973-08-14 09:11:22.089786 1
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/r/function_defaults_innodb.result
Expand Up @@ -1444,7 +1444,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
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;
a b
1 1970-01-01 03:16:40
Expand All @@ -1467,7 +1467,7 @@ a c
1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789;
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;
a c
1973-08-14 09:11:22 1
Expand Down Expand Up @@ -2990,7 +2990,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
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;
a b
1 1970-01-01 03:16:40.123456
Expand All @@ -3013,7 +3013,7 @@ a c
1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789;
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;
a c
1973-08-14 09:11:22.089786 1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/key.result
Expand Up @@ -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 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;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/partition_explicit_prune.result
Expand Up @@ -126,7 +126,7 @@ HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
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
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
Expand All @@ -135,7 +135,7 @@ HANDLER_TMP_WRITE 22
# 2 locks (1 table, all partitions pruned)
FLUSH STATUS;
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
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/replace.result
Expand Up @@ -27,6 +27,6 @@ drop table t1;
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
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 VIEW v1;
2 changes: 1 addition & 1 deletion mysql-test/r/subselect.result
Expand Up @@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS
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;
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;
c
1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/subselect_no_exists_to_in.result
Expand Up @@ -5003,7 +5003,7 @@ CREATE VIEW v2 (a,b) AS
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;
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;
c
1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/subselect_no_mat.result
Expand Up @@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS
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;
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;
c
1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/subselect_no_opts.result
Expand Up @@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS
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;
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;
c
1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/subselect_no_scache.result
Expand Up @@ -5007,7 +5007,7 @@ CREATE VIEW v2 (a,b) AS
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;
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;
c
1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/subselect_no_semijoin.result
Expand Up @@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS
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;
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;
c
1
Expand Down

0 comments on commit 99e48cb

Please sign in to comment.