diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-01-11 00:35:47 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-01-14 22:16:39 +0100 |
commit | 3548e80bc49892a574a89986c0b94fa3d85b0534 (patch) | |
tree | ead5e17a4163bdfe5eaad923a9a915d18e818d8b | |
parent | a88a4336fc4813c33a719db540816659097632c3 (diff) | |
download | mariadb-git-3548e80bc49892a574a89986c0b94fa3d85b0534.tar.gz |
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.
-rw-r--r-- | mysql-test/r/show.result | 11 | ||||
-rw-r--r-- | mysql-test/t/show.test | 8 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/mysql-test/r/show.result b/mysql-test/r/show.result index d1b373d8969..4a9e2738346 100644 --- a/mysql-test/r/show.result +++ b/mysql-test/r/show.result @@ -40,5 +40,16 @@ nm varchar(32) YES NULL a int(11) YES NULL 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 # diff --git a/mysql-test/t/show.test b/mysql-test/t/show.test index f2f6efc4e45..9b0b58349d5 100644 --- a/mysql-test/t/show.test +++ b/mysql-test/t/show.test @@ -35,5 +35,13 @@ show fields from test.t1 where field in 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 # End of 10.2 tests --echo # diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 710c68d2551..9483db9eff9 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -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}, {"COLUMN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name", 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", OPEN_FULL_TABLE}, {"SUB_PART", 3, MYSQL_TYPE_LONGLONG, 0, 1, "Sub_part", OPEN_FRM_ONLY}, |