1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-37292 Hint NO_INDEX() disables all indexes if none of given index names is resolved

When a hint has a list of index names, for example,
  `NO_INDEX(t1 idx1, idx2)`
there is a possibility that some or all of the listed index names will
not be resolved. If none of them are resolved, the hint becomes a table-level
hint, for example, `NO_INDEX(t1)`, which erroneously disables all indexes
of `t1` instead of disabling only some of them.

This commit addresses this issue by adding an additional check: a hint
containing a list of index names is considered resolved only when at least one
of the listed names is resolved successfully.
This commit is contained in:
Oleg Smirnov
2025-07-26 21:00:23 +07:00
committed by Sergei Golubchik
parent c329c43be7
commit 893761b35c
6 changed files with 175 additions and 9 deletions

View File

@@ -588,7 +588,13 @@ bool Parser::Index_level_hint::resolve(Parse_context *pc) const
const Lex_ident_sys key_conflict(
STRING_WITH_LEN("another hint was already specified for this index"));
if (is_empty()) // Empty list of index names, i.e. it is a table level hint
/*
If no index names are given, this is a table level hint, for example:
GROUP_INDEX(t1), NO_MRR(t2).
Otherwise this is a group of index-level hints:
NO_INDEX(t1 idx1, idx2) NO_ICP(t2 idx_a, idx_b, idx_c)
*/
if (is_empty())
{
uint warn_code= 0;
if (is_compound_hint(hint_type) &&