diff --git a/mysql-test/r/check_constraint.result b/mysql-test/r/check_constraint.result index a9e8b1138e99a..5a1afd64e5b8f 100644 --- a/mysql-test/r/check_constraint.result +++ b/mysql-test/r/check_constraint.result @@ -95,3 +95,36 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; +create or replace table t1 (a int, b int, constraint check (a>b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + CONSTRAINT `CONSTRAINT_1` CHECK (a>b) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a int, b int, +constraint CONSTRAINT_1 check (a>1), +constraint check (b>1)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + CONSTRAINT `CONSTRAINT_1` CHECK (a>1), + CONSTRAINT `CONSTRAINT_2` CHECK (b>1) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a int, b int, +constraint CONSTRAINT_1 check (a>1), +constraint check (b>1), +constraint CONSTRAINT_2 check (a>b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + CONSTRAINT `CONSTRAINT_1` CHECK (a>1), + CONSTRAINT `CONSTRAINT_3` CHECK (b>1), + CONSTRAINT `CONSTRAINT_2` CHECK (a>b) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/check_constraint.test b/mysql-test/t/check_constraint.test index 45b85436ec483..7bd6a654e9b4a 100644 --- a/mysql-test/t/check_constraint.test +++ b/mysql-test/t/check_constraint.test @@ -52,3 +52,19 @@ alter table t2 drop constraint min; show create table t2; drop table t1,t2; + +# +# check constraint name auto-generation: +# +create or replace table t1 (a int, b int, constraint check (a>b)); +show create table t1; +create or replace table t1 (a int, b int, + constraint CONSTRAINT_1 check (a>1), + constraint check (b>1)); +show create table t1; +create or replace table t1 (a int, b int, + constraint CONSTRAINT_1 check (a>1), + constraint check (b>1), + constraint CONSTRAINT_2 check (a>b)); +show create table t1; +drop table t1; diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test index e24039cc2ac40..1997c23bfa9f0 100644 --- a/mysql-test/t/constraints.test +++ b/mysql-test/t/constraints.test @@ -1,6 +1,5 @@ # # Testing of constraints -# Currently MySQL only ignores the syntax. # --disable_warnings drop table if exists t1;