mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
6990f6cf7e
Second edition: error message was deleted as Segey suggested Now name of the constraint will be used as the name of the key if the last not specified mysql-test/r/constraints.result: appropriate test result mysql-test/t/constraints.test: test case for 1189 sql/sql_yacc.yy: language definitions changed so that we can obtaint constraint's name and send it as the name of the key if it's not specified
29 lines
798 B
Text
29 lines
798 B
Text
#
|
|
# Testing of constraints
|
|
# Currently MySQL only ignores the syntax.
|
|
#
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
|
|
create table t1 (a int check (a>0));
|
|
insert into t1 values (1);
|
|
insert into t1 values (0);
|
|
drop table t1;
|
|
create table t1 (a int ,b int, check a>b);
|
|
insert into t1 values (1,0);
|
|
insert into t1 values (0,1);
|
|
drop table t1;
|
|
create table t1 (a int ,b int, constraint abc check (a>b));
|
|
insert into t1 values (1,0);
|
|
insert into t1 values (0,1);
|
|
drop table t1;
|
|
create table t1 (a int null);
|
|
insert into t1 values (1),(NULL);
|
|
drop table t1;
|
|
create table t1 (a int null);
|
|
alter table t1 add constraint constraint_1 unique (a);
|
|
alter table t1 add constraint unique key_1(a);
|
|
alter table t1 add constraint constraint_2 unique key_2(a);
|
|
show create table t1;
|
|
drop table t1;
|