Skip to content

Commit 3548e80

Browse files
committed
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.
1 parent a88a433 commit 3548e80

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

mysql-test/r/show.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,16 @@ nm varchar(32) YES NULL
4040
a int(11) YES NULL
4141
drop table t1;
4242
#
43+
# MDEV-4621 select returns null for information_schema.statistics.collation field
44+
#
45+
create table t1 (f varchar(64), key(f));
46+
select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
47+
index_name column_name collation cardinality
48+
f f A NULL
49+
select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
50+
index_name column_name collation
51+
f f A
52+
drop table t1;
53+
#
4354
# End of 10.2 tests
4455
#

mysql-test/t/show.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ show fields from test.t1 where field in
3434
where table_name='t1' group by column_name) dt);
3535
drop table t1;
3636

37+
--echo #
38+
--echo # MDEV-4621 select returns null for information_schema.statistics.collation field
39+
--echo #
40+
create table t1 (f varchar(64), key(f));
41+
select index_name, column_name, collation, cardinality from information_schema.STATISTICS where table_schema='test' and table_name='t1';
42+
select index_name, column_name, collation from information_schema.STATISTICS where table_schema='test' and table_name='t1';
43+
drop table t1;
44+
3745
--echo #
3846
--echo # End of 10.2 tests
3947
--echo #

sql/sql_show.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8967,7 +8967,7 @@ ST_FIELD_INFO stat_fields_info[]=
89678967
{"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONGLONG, 0, 0, "Seq_in_index", OPEN_FRM_ONLY},
89688968
{"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name",
89698969
OPEN_FRM_ONLY},
8970-
{"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
8970+
{"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FULL_TABLE},
89718971
{"CARDINALITY", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 1,
89728972
"Cardinality", OPEN_FULL_TABLE},
89738973
{"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", OPEN_FRM_ONLY},

0 commit comments

Comments
 (0)