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

@@ -656,6 +656,14 @@ public:
public:
using AND4::AND4;
/*
If no index names are given, this is a table level hint, for example:
GROUP_INDEX(t1), NO_MRR(t2).
Otherwise this is an index-level hints:
NO_INDEX(t1 idx1, idx2) NO_ICP(t2 idx_a, idx_b, idx_c)
*/
bool is_table_level_hint() const { return is_empty(); }
bool resolve(Parse_context *pc) const;
void append_args(THD *thd, String *str) const override;
};