summaryrefslogtreecommitdiff
path: root/mysql-test/suite/funcs_1
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-12-25 13:33:28 +0400
committerAlexander Barkov <bar@mariadb.com>2019-12-25 13:33:28 +0400
commit4c57ab34d4852387da4ef8eac862045d1458de1e (patch)
tree743ed619818e8862b9707f7c8f12691eeda76db5 /mysql-test/suite/funcs_1
parent3fbd9f1522cf52247b9659cd50efe367767abf0e (diff)
parentee9a19fb054085fcea006a25ec957e0d5cb01ce8 (diff)
downloadmariadb-git-4c57ab34d4852387da4ef8eac862045d1458de1e.tar.gz
Merge remote-tracking branch 'origin/10.3' into 10.4
Diffstat (limited to 'mysql-test/suite/funcs_1')
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraint.result121
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraints.result272
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraint.test92
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraints.test103
6 files changed, 202 insertions, 398 deletions
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraint.result b/mysql-test/suite/funcs_1/r/is_check_constraint.result
deleted file mode 100644
index be44a8867e8..00000000000
--- a/mysql-test/suite/funcs_1/r/is_check_constraint.result
+++ /dev/null
@@ -1,121 +0,0 @@
-#
-# MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
-#
-CREATE user boo1;
-GRANT select,create,alter,drop on foo.* to boo1;
-SHOW GRANTS for boo1;
-Grants for boo1@%
-GRANT USAGE ON *.* TO 'boo1'@'%'
-GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
-CREATE user boo2;
-create database foo;
-CONNECT con1,localhost, boo1,, foo;
-SET check_constraint_checks=1;
-CREATE TABLE t0
-(
-t int, check (t>32) # table constraint
-) ENGINE=myisam;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-ALTER TABLE t0
-ADD CONSTRAINT CHK_t0_t CHECK(t<100);
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_t0_t t0 `t` < 100
-def foo CONSTRAINT_1 t0 `t` > 32
-ALTER TABLE t0
-DROP CONSTRAINT CHK_t0_t;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-ALTER TABLE t0
-ADD CONSTRAINT CHECK(t<50);
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-CREATE TABLE t1
-( t int CHECK(t>2), # field constraint
-tt int,
-CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
-CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
-) ENGINE=InnoDB;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_tt t1 `tt` < 100
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo t t1 `t` > 2
-ALTER TABLE t1
-DROP CONSTRAINT CHK_tt;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo t t1 `t` > 2
-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;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_dates t2 `start_date` is null
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo name t2 char_length(`name`) > 2
-def foo t t1 `t` > 2
-ALTER TABLE t1
-ADD CONSTRAINT CHK_new_ CHECK(t>tt);
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_dates t2 `start_date` is null
-def foo CHK_new_ t1 `t` > `tt`
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo name t2 char_length(`name`) > 2
-def foo t t1 `t` > 2
-CREATE TABLE t3
-(
-a int,
-b int check (b>0), # field constraint named 'b'
-CONSTRAINT b check (b>10) # table constraint
-) ENGINE=InnoDB;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_dates t2 `start_date` is null
-def foo CHK_new_ t1 `t` > `tt`
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo b t3 `b` > 0
-def foo b t3 `b` > 10
-def foo name t2 char_length(`name`) > 2
-def foo t t1 `t` > 2
-disconnect con1;
-CONNECT con2, localhost, boo2,, test;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-disconnect con2;
-CONNECT con1, localhost, boo1,,foo;
-DROP TABLE t0;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP DATABASE foo;
-disconnect con1;
-connection default;
-DROP USER boo1;
-DROP USER boo2;
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result
index eaf90f44544..307c14792a9 100644
--- a/mysql-test/suite/funcs_1/r/is_check_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result
@@ -1,180 +1,148 @@
#
# MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
#
-set check_constraint_checks=1;
-use test;
-create table t0
+CREATE user boo1;
+GRANT select,create,alter,drop on foo.* to boo1;
+SHOW GRANTS for boo1;
+Grants for boo1@%
+GRANT USAGE ON *.* TO 'boo1'@'%'
+GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
+CREATE user boo2;
+create database foo;
+CONNECT con1,localhost, boo1,, foo;
+SET check_constraint_checks=1;
+CREATE TABLE t0
(
t int, check (t>32) # table constraint
) ENGINE=myisam;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
ALTER TABLE t0
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_t0_t
-TABLE_NAME t0
-CHECK_CLAUSE `t` < 100
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CHK_t0_t `t` < 100
+def foo t0 CONSTRAINT_1 `t` > 32
ALTER TABLE t0
DROP CONSTRAINT CHK_t0_t;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+ALTER TABLE t0
+ADD CONSTRAINT CHECK(t<50);
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
CREATE TABLE t1
( t int CHECK(t>2), # field constraint
-tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
+tt int,
+CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
+CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
) ENGINE=InnoDB;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_tt
-TABLE_NAME t1
-CHECK_CLAUSE `tt` < 100
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CHK_tt `tt` < 100
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
ALTER TABLE t1
DROP CONSTRAINT CHK_tt;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
-create table t2
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+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;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME name
-TABLE_NAME t2
-CHECK_CLAUSE char_length(`name`) > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_dates
-TABLE_NAME t2
-CHECK_CLAUSE `start_date` is null
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+def foo t2 CHK_dates `start_date` is null
+def foo t2 name char_length(`name`) > 2
ALTER TABLE t1
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME name
-TABLE_NAME t2
-CHECK_CLAUSE char_length(`name`) > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_dates
-TABLE_NAME t2
-CHECK_CLAUSE `start_date` is null
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_new_
-TABLE_NAME t1
-CHECK_CLAUSE `t` > `tt`
-create table t3
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CHK_new_ `t` > `tt`
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+def foo t2 CHK_dates `start_date` is null
+def foo t2 name char_length(`name`) > 2
+CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
) ENGINE=InnoDB;
-select * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def test name t2 char_length(`name`) > 2
-def mysql Priv global_priv json_valid(`Priv`)
-def test b t3 `b` > 0
-def test b t3 `b` > 10
-def test CHK_dates t2 `start_date` is null
-def test t t1 `t` > 2
-def test CONSTRAINT_1 t0 `t` > 32
-def test CHK_new_ t1 `t` > `tt`
-drop table t0;
-drop table t1;
-drop table t2;
-drop table t3;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CHK_new_ `t` > `tt`
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+def foo t2 CHK_dates `start_date` is null
+def foo t2 name char_length(`name`) > 2
+def foo t3 b `b` > 0
+def foo t3 b `b` > 10
+disconnect con1;
+CONNECT con2, localhost, boo2,, test;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+disconnect con2;
+CONNECT con1, localhost, boo1,,foo;
+DROP TABLE t0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP DATABASE foo;
+disconnect con1;
+connection default;
+DROP USER boo1;
+DROP USER boo2;
+#
+# MDEV-18440: Information_schema.check_constraints possible data leak
+#
+CREATE USER foo;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
+INSERT INTO t1 VALUES (1, 2), (2, 3);
+GRANT SELECT (a) ON t1 TO foo;
+SHOW GRANTS FOR foo;
+Grants for foo@%
+GRANT USAGE ON *.* TO 'foo'@'%'
+GRANT SELECT (a) ON `db`.`t1` TO 'foo'@'%'
+SELECT * FROM information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def db t1 CONSTRAINT_1 `b` > 0
+def mysql global_priv Priv json_valid(`Priv`)
+CONNECT con1,localhost, foo,, db;
+SELECT a FROM t1;
+a
+1
+2
+SELECT * FROM information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+connection default;
+DROP USER foo;
+DROP DATABASE db;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 386b0f07f98..e4797521889 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -26,9 +26,9 @@ def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NU
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL
-def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
+def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
-def information_schema CHECK_CONSTRAINTS TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
+def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL
@@ -568,8 +568,8 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index 97346c4648d..4fc90b8433d 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -26,9 +26,9 @@ def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NU
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL
def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
-def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
+def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
-def information_schema CHECK_CONSTRAINTS TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
+def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL
@@ -568,8 +568,8 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraint.test b/mysql-test/suite/funcs_1/t/is_check_constraint.test
deleted file mode 100644
index 30a72d02b34..00000000000
--- a/mysql-test/suite/funcs_1/t/is_check_constraint.test
+++ /dev/null
@@ -1,92 +0,0 @@
---source include/have_innodb.inc
---source include/not_embedded.inc
---echo #
---echo # MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
---echo #
-CREATE user boo1;
-GRANT select,create,alter,drop on foo.* to boo1;
-SHOW GRANTS for boo1;
-CREATE user boo2;
-create database foo;
-# Connect with user boo1
-CONNECT(con1,localhost, boo1,, foo);
-
-SET check_constraint_checks=1;
-CREATE TABLE t0
-(
- t int, check (t>32) # table constraint
-) ENGINE=myisam;
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t0
-ADD CONSTRAINT CHK_t0_t CHECK(t<100);
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t0
-DROP CONSTRAINT CHK_t0_t;
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t0
-ADD CONSTRAINT CHECK(t<50);
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-CREATE TABLE t1
-( t int CHECK(t>2), # field constraint
- tt int,
- CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
- CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
-) ENGINE=InnoDB;
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t1
-DROP CONSTRAINT CHK_tt;
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-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;
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t1
-ADD CONSTRAINT CHK_new_ CHECK(t>tt);
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-# 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;
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-DISCONNECT con1;
-CONNECT(con2, localhost, boo2,, test);
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-DISCONNECT con2;
-CONNECT(con1, localhost, boo1,,foo);
-DROP TABLE t0;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP DATABASE foo;
-
-DISCONNECT con1;
---CONNECTION default
-DROP USER boo1;
-DROP USER boo2;
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraints.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test
index b39abdc1b24..b539de67f73 100644
--- a/mysql-test/suite/funcs_1/t/is_check_constraints.test
+++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test
@@ -1,69 +1,118 @@
--source include/have_innodb.inc
+--source include/not_embedded.inc
--echo #
--echo # MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
--echo #
-set check_constraint_checks=1;
+CREATE user boo1;
+GRANT select,create,alter,drop on foo.* to boo1;
+SHOW GRANTS for boo1;
+CREATE user boo2;
+create database foo;
+# Connect with user boo1
+CONNECT(con1,localhost, boo1,, foo);
-use test;
-create table t0
+SET check_constraint_checks=1;
+CREATE TABLE t0
(
t int, check (t>32) # table constraint
) ENGINE=myisam;
-
---vertical_results
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t0
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
-
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t0
DROP CONSTRAINT CHK_t0_t;
+--sorted_result
+SELECT * from information_schema.check_constraints;
-SELECT * from information_schema.check_constraints order by check_clause;
+ALTER TABLE t0
+ADD CONSTRAINT CHECK(t<50);
+--sorted_result
+SELECT * from information_schema.check_constraints;
CREATE TABLE t1
( t int CHECK(t>2), # field constraint
- tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
+ tt int,
+ CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
+ CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
) ENGINE=InnoDB;
-
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t1
DROP CONSTRAINT CHK_tt;
+--sorted_result
+SELECT * from information_schema.check_constraints;
-SELECT * from information_schema.check_constraints order by check_clause;
-
-create table t2
+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;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t1
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
-
-SELECT * from information_schema.check_constraints order by check_clause;
-
+--sorted_result
+SELECT * from information_schema.check_constraints;
# Create table with same field and table check constraint name
-create table t3
+CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
) ENGINE=InnoDB;
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+DISCONNECT con1;
+CONNECT(con2, localhost, boo2,, test);
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+DISCONNECT con2;
+CONNECT(con1, localhost, boo1,,foo);
+DROP TABLE t0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP DATABASE foo;
+
+DISCONNECT con1;
+--CONNECTION default
+DROP USER boo1;
+DROP USER boo2;
+
+--echo #
+--echo # MDEV-18440: Information_schema.check_constraints possible data leak
+--echo #
+
+CREATE USER foo;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
+INSERT INTO t1 VALUES (1, 2), (2, 3);
+GRANT SELECT (a) ON t1 TO foo;
+
+SHOW GRANTS FOR foo;
+--sorted_result
+SELECT * FROM information_schema.check_constraints;
+
+CONNECT(con1,localhost, foo,, db);
+SELECT a FROM t1;
+--sorted_result
+SELECT * FROM information_schema.check_constraints;
---horizontal_results
-select * from information_schema.check_constraints order by check_clause;
+--CONNECTION default
-drop table t0;
-drop table t1;
-drop table t2;
-drop table t3;
+DROP USER foo;
+DROP DATABASE db;