1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-4621 select returns null for information_schema.statistics.collation field

information_schema.statistics.collation column needs OPEN_FULL_TABLE,
because it checks index_flags() for HA_READ_ORDER capability.
This commit is contained in:
Sergei Golubchik
2022-01-11 00:35:47 +01:00
parent a88a4336fc
commit 3548e80bc4
3 changed files with 20 additions and 1 deletions

View File

@ -40,5 +40,16 @@ nm varchar(32) YES NULL
a int(11) YES NULL a int(11) YES NULL
drop table t1; drop table t1;
# #
# MDEV-4621 select returns null for information_schema.statistics.collation field
#
create table t1 (f varchar(64), key(f));
select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
index_name column_name collation cardinality
f f A NULL
select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
index_name column_name collation
f f A
drop table t1;
#
# End of 10.2 tests # End of 10.2 tests
# #

View File

@ -34,6 +34,14 @@ show fields from test.t1 where field in
where table_name='t1' group by column_name) dt); where table_name='t1' group by column_name) dt);
drop table t1; drop table t1;
--echo #
--echo # MDEV-4621 select returns null for information_schema.statistics.collation field
--echo #
create table t1 (f varchar(64), key(f));
select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
drop table t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

@ -8967,7 +8967,7 @@ ST_FIELD_INFO stat_fields_info[]=
{"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONGLONG, 0, 0, "Seq_in_index", OPEN_FRM_ONLY}, {"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONGLONG, 0, 0, "Seq_in_index", OPEN_FRM_ONLY},
{"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name", {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name",
OPEN_FRM_ONLY}, OPEN_FRM_ONLY},
{"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY}, {"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FULL_TABLE},
{"CARDINALITY", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 1, {"CARDINALITY", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 1,
"Cardinality", OPEN_FULL_TABLE}, "Cardinality", OPEN_FULL_TABLE},
{"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", OPEN_FRM_ONLY}, {"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", OPEN_FRM_ONLY},