1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
PR#1127: Fix is_check_constraints.result to be compatibile with 10.3

The patch is done according to the original patch for MDEV-14474
1edd09c325 and not one which is merged on server
d526679efd.
This patch includes:
- Rename from `is_check_constraint` to `is_check_constraints` to tests
and results
- Per review, change the order of fields in IS check_constraints table by adding
the column `table_name` before `constraint_name`. According to the standard
2006 there is no `table_name` column.
- Original patch and one in `10.3` supports embedded server this patch doesn't
support. After the merge `10.3` will not support also.
- Don't use patch c8b8b01b61 to change the length of `CHECK_CLAUSE` field

PR#1150: MDEV-18440: Information_schema.check_constraints possible data leak

This patch is extension of PR 1127 and includes:
- Check for table grants
- Additional test according to the MDEV specification
This commit is contained in:
Anel Husakovic
2019-01-24 03:06:56 -08:00
committed by Vicențiu Ciorbaru
parent f0aa073f2b
commit a134f1ebb1
3 changed files with 83 additions and 13 deletions

View File

@ -40,7 +40,7 @@ CREATE TABLE t1
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
--sorted_result
SELECT * from information_schema.check_constraints;
ALTER TABLE t1
@ -55,7 +55,7 @@ start_date DATE,
end_date DATE,
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
)ENGINE=Innodb;
--sorted_result
--sorted_result
SELECT * from information_schema.check_constraints;
ALTER TABLE t1
@ -70,12 +70,12 @@ a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
) ENGINE=InnoDB;
--sorted_result
--sorted_result
SELECT * from information_schema.check_constraints;
DISCONNECT con1;
CONNECT(con2, localhost, boo2,, test);
--sorted_result
--sorted_result
SELECT * from information_schema.check_constraints;
DISCONNECT con2;
@ -90,3 +90,28 @@ 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;
--CONNECTION default
DROP USER foo;
DROP DATABASE db;