[Commits] 9f33288dde9: MDEV-11115 CHECK constraints are not shown in I_S.TABLE_CONSTRAINTS

jacob.mathew at mariadb.com jacob.mathew at mariadb.com
Thu Mar 16 23:45:55 EET 2017


revision-id: 9f33288dde950343c46e6c5d6a4f233de191f477 (mariadb-10.2.3-245-g9f33288dde9)
parent(s): 7c152ac68a7993bca99ef23e073b0a0974b087a1
author: Jacob Mathew
committer: Jacob Mathew
timestamp: 2017-03-16 14:41:41 -0700
message:

MDEV-11115 CHECK constraints are not shown in I_S.TABLE_CONSTRAINTS

Add test case: check_constraint_show

---
 mysql-test/r/check_constraint_show.result | 19 +++++++++++++++++++
 mysql-test/t/check_constraint_show.test   |  8 ++++++++
 2 files changed, 27 insertions(+)

diff --git a/mysql-test/r/check_constraint_show.result b/mysql-test/r/check_constraint_show.result
new file mode 100644
index 00000000000..795c6133802
--- /dev/null
+++ b/mysql-test/r/check_constraint_show.result
@@ -0,0 +1,19 @@
+create or replace table t1( c1 int, c2 int, c3 int, primary key( c1 ), constraint `c1_min` check( c1 > 0 ), constraint `c3_min` check( c3 > 0 ), constraint `range`  check( ( c2 >= c1 ) and ( c2 <= c3 ) ) );
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  PRIMARY KEY (`c1`),
+  CONSTRAINT `c1_min` CHECK (`c1` > 0),
+  CONSTRAINT `c3_min` CHECK (`c3` > 0),
+  CONSTRAINT `range` CHECK (`c2` >= `c1` and `c2` <= `c3`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from information_schema.table_constraints where table_name = 't1';
+CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
+def	test	PRIMARY	test	t1	PRIMARY KEY
+def	test	c1_min	test	t1	CHECK
+def	test	c3_min	test	t1	CHECK
+def	test	range	test	t1	CHECK
+drop table t1;
diff --git a/mysql-test/t/check_constraint_show.test b/mysql-test/t/check_constraint_show.test
new file mode 100644
index 00000000000..0e2f45883df
--- /dev/null
+++ b/mysql-test/t/check_constraint_show.test
@@ -0,0 +1,8 @@
+# Table with 2 column-level check constraints and 1 table-level check constraint
+create or replace table t1( c1 int, c2 int, c3 int, primary key( c1 ), constraint `c1_min` check( c1 > 0 ), constraint `c3_min` check( c3 > 0 ), constraint `range`  check( ( c2 >= c1 ) and ( c2 <= c3 ) ) );
+show create table t1;
+
+# Show all constraints, including check constraints
+select * from information_schema.table_constraints where table_name = 't1';
+
+drop table t1;


More information about the commits mailing list