From ae9a4799d7db44e06d49c273375e589e25d54dd7 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 18 Apr 2024 16:29:19 +0300 Subject: [PATCH] MDEV-33938 Analyze table on sequences should be prohibited --- mysql-test/suite/sql_sequence/binlog.result | 1 - sql/sql_admin.cc | 2 +- sql/sql_statistics.cc | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/sql_sequence/binlog.result b/mysql-test/suite/sql_sequence/binlog.result index 843cf74c2fa..32788c988fc 100644 --- a/mysql-test/suite/sql_sequence/binlog.result +++ b/mysql-test/suite/sql_sequence/binlog.result @@ -17,7 +17,6 @@ Table Op Msg_type Msg_text test.s1 optimize note The storage engine for the table doesn't support optimize analyze table s1; Table Op Msg_type Msg_text -test.s1 analyze status Engine-independent statistics collected test.s1 analyze note The storage engine for the table doesn't support analyze repair table s1; Table Op Msg_type Msg_text diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 8ebceb1e7ca..835d910282d 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -924,7 +924,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, appropriate action is to just not collect EITS stats for this command. */ collect_eis= - (table->table->s->table_category == TABLE_CATEGORY_USER && + (tab->s->table_category == TABLE_CATEGORY_USER && !tab->s->sequence && !(lex->alter_info.partition_flags & ALTER_PARTITION_ADMIN) && (check_eits_collection_allowed(thd) || lex->with_persistent_for_clause)); diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 05c50ff0bda..fe6d8cf618f 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -3268,7 +3268,8 @@ read_statistics_for_tables(THD *thd, TABLE_LIST *tables, bool force_reload) TABLE_SHARE *table_share; /* Skip tables that can't have statistics. */ - if (tl->is_view_or_derived() || !table || !(table_share= table->s)) + if (tl->is_view_or_derived() || !table || !(table_share= table->s) || + table_share->sequence) continue; /* Skip temporary tables */ if (table_share->tmp_table != NO_TMP_TABLE)