summaryrefslogtreecommitdiff
path: root/mysql-test/suite/funcs_1/t
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-09-11 21:31:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-09-11 21:31:03 +0300
commit1bf3e8ab43e982953d7534db902020d321364afb (patch)
tree7de4aaac9f947d4302cd4edbb5677da8917ade71 /mysql-test/suite/funcs_1/t
parentf5bebaf1d6a0ff2fca9b342ed5910b9d34a276bb (diff)
parent4901f31c13f91e130f077f2f77b32c40b0036e32 (diff)
downloadmariadb-git-1bf3e8ab43e982953d7534db902020d321364afb.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/suite/funcs_1/t')
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraints.test69
1 files changed, 69 insertions, 0 deletions
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraints.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test
new file mode 100644
index 00000000000..b39abdc1b24
--- /dev/null
+++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test
@@ -0,0 +1,69 @@
+--source include/have_innodb.inc
+--echo #
+--echo # MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
+--echo #
+
+set check_constraint_checks=1;
+
+use test;
+create table t0
+(
+ t int, check (t>32) # table constraint
+) ENGINE=myisam;
+
+--vertical_results
+SELECT * from information_schema.check_constraints order by check_clause;
+
+ALTER TABLE t0
+ADD CONSTRAINT CHK_t0_t CHECK(t<100);
+
+SELECT * from information_schema.check_constraints order by check_clause;
+
+ALTER TABLE t0
+DROP CONSTRAINT CHK_t0_t;
+
+SELECT * from information_schema.check_constraints order by check_clause;
+
+CREATE TABLE t1
+( t int CHECK(t>2), # field constraint
+ tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
+) ENGINE=InnoDB;
+
+SELECT * from information_schema.check_constraints order by check_clause;
+
+ALTER TABLE t1
+DROP CONSTRAINT CHK_tt;
+
+SELECT * from information_schema.check_constraints order by check_clause;
+
+create table t2
+(
+name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
+start_date DATE,
+end_date DATE,
+CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
+)ENGINE=Innodb;
+
+SELECT * from information_schema.check_constraints order by check_clause;
+
+ALTER TABLE t1
+ADD CONSTRAINT CHK_new_ CHECK(t>tt);
+
+SELECT * from information_schema.check_constraints order by check_clause;
+
+
+# Create table with same field and table check constraint name
+create table t3
+(
+a int,
+b int check (b>0), # field constraint named 'b'
+CONSTRAINT b check (b>10) # table constraint
+) ENGINE=InnoDB;
+
+--horizontal_results
+select * from information_schema.check_constraints order by check_clause;
+
+drop table t0;
+drop table t1;
+drop table t2;
+drop table t3;