1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-24601: INFORMATION_SCHEMA doesn't differentiate between column and table-level CHECK constraints

- Reviewed by: wlad@mariadb.com
This commit is contained in:
Anel Husakovic
2021-03-16 12:03:41 +01:00
parent 8cbada87f0
commit 825c0e2abe
5 changed files with 129 additions and 61 deletions

View File

@ -6932,10 +6932,14 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables,
table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
table->field[3]->store(check->name.str, check->name.length,
system_charset_info);
const char *tmp_buff;
tmp_buff= (check->get_vcol_type() == VCOL_CHECK_FIELD ?
"Column" : "Table");
table->field[4]->store(tmp_buff, strlen(tmp_buff), system_charset_info);
/* Make sure the string is empty between each print. */
str.length(0);
check->print(&str);
table->field[4]->store(str.ptr(), str.length(), system_charset_info);
table->field[5]->store(str.ptr(), str.length(), system_charset_info);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
}
@ -9508,6 +9512,7 @@ ST_FIELD_INFO check_constraints_fields_info[]=
Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
Column("LEVEL", Varchar(6),NOT_NULL, OPEN_FULL_TABLE),
Column("CHECK_CLAUSE", Longtext(MAX_FIELD_VARCHARLENGTH),
NOT_NULL, OPEN_FULL_TABLE),
CEnd()
@ -9524,7 +9529,7 @@ extern ST_FIELD_INFO optimizer_trace_info[];
} //namespace Show
/*
Description of ST_FIELD_INFO in table.h
Description of ST_FIELD_INFO in sql_i_s.h
Make sure that the order of schema_tables and enum_schema_tables are the same.