Commit f924a3bd authored by Anel Husakovic's avatar Anel Husakovic

MDEV-24139: CHECK_CLAUSE field in INFORMATION_SCHEMA.CHECK_CONSTRAINTS...

MDEV-24139: CHECK_CLAUSE field in INFORMATION_SCHEMA.CHECK_CONSTRAINTS truncate check constraints expressions

- Reviewed by: daniel@mariadb.org
parent eb7b14ec
......@@ -843,6 +843,7 @@ information_schema.columns
where data_type = 'longtext' and table_schema != 'performance_schema';
table_schema table_name column_name
information_schema ALL_PLUGINS PLUGIN_DESCRIPTION
information_schema CHECK_CONSTRAINTS CHECK_CLAUSE
information_schema COLUMNS COLUMN_DEFAULT
information_schema COLUMNS COLUMN_TYPE
information_schema COLUMNS GENERATION_EXPRESSION
......
......@@ -90,7 +90,9 @@ CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
CONSTRAINT b check (b>10), # table constraint
# `CHECK_CLAUSE` should allow more then `var(64)` constraints
CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567890123456789)
) ENGINE=InnoDB;
SELECT * from information_schema.check_constraints;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
......@@ -104,6 +106,7 @@ 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
def foo t3 b1 `b` < 123456789012345678901234567890123456789012345678901234567890123456789
disconnect con1;
CONNECT con2, localhost, boo2,, test;
SELECT * from information_schema.check_constraints;
......
......@@ -24,7 +24,7 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N
def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select NEVER NULL
def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select NEVER NULL
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 CHECK_CLAUSE 5 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext 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 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
......@@ -563,7 +563,7 @@ NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 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)
1.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
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)
NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
......
......@@ -24,7 +24,7 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N
def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) NEVER NULL
def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) NEVER NULL
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 CHECK_CLAUSE 5 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext 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 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
......@@ -563,7 +563,7 @@ NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 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)
1.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
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)
NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
......
......@@ -85,9 +85,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
ENGINE MYISAM_OR_MARIA
VERSION 11
ROW_FORMAT Fixed
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
......@@ -1044,9 +1044,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
ENGINE MYISAM_OR_MARIA
VERSION 11
ROW_FORMAT Fixed
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
......
......@@ -85,9 +85,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
ENGINE MYISAM_OR_MARIA
VERSION 11
ROW_FORMAT Fixed
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
......@@ -1044,9 +1044,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
ENGINE MYISAM_OR_MARIA
VERSION 11
ROW_FORMAT Fixed
ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
......
......@@ -68,7 +68,9 @@ CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
CONSTRAINT b check (b>10), # table constraint
# `CHECK_CLAUSE` should allow more then `var(64)` constraints
CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567890123456789)
) ENGINE=InnoDB;
--sorted_result
SELECT * from information_schema.check_constraints;
......
......@@ -9410,7 +9410,7 @@ ST_FIELD_INFO check_constraints_fields_info[]=
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
{"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
OPEN_FULL_TABLE},
{"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
{"CHECK_CLAUSE", MAX_FIELD_VARCHARLENGTH , MYSQL_TYPE_STRING, 0, 0, 0,
OPEN_FULL_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment