Skip to content

Commit 96d66c9

Browse files
committed
Bug#35710213: mysql server 8.1.0 failed at Item_field::used_tables
The original fix for this problem caused a regression in test i_main.fulltext-bug17865492 in --ps-protocol mode. The reason for this is a missing implementation of the function update_used_tables() for the class Item_func_match. When rebuilding used tables information and item properties, the argument "against" is never considered. This means that for execution of prepared statements, the Item_func_match expression is no longer considered to be an aggregated expression, and the optimizer will pick the wrong substitution field when setting up an intermediate temporary table. The fix for this problem is to implement update_used_tables() for this class, and explicitly add used tables information and properties for the "against" argument. Change-Id: Ic3a4c61ae6706a772a2c3616927a08751a3ade42
1 parent a7eff95 commit 96d66c9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

sql/item_func.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7630,6 +7630,13 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref) {
76307630
arg_count, 0);
76317631
}
76327632

7633+
void Item_func_match::update_used_tables() {
7634+
Item_func::update_used_tables();
7635+
against->update_used_tables();
7636+
used_tables_cache |= against->used_tables();
7637+
add_accum_properties(against);
7638+
}
7639+
76337640
bool Item_func_match::fix_index(const THD *thd) {
76347641
TABLE *table;
76357642
uint ft_to_key[MAX_KEY], ft_cnt[MAX_KEY], fts = 0, keynr;

sql/item_func.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,6 +3457,7 @@ class Item_func_match final : public Item_real_func {
34573457
enum Functype functype() const override { return FT_FUNC; }
34583458
const char *func_name() const override { return "match"; }
34593459
bool fix_fields(THD *thd, Item **ref) override;
3460+
void update_used_tables() override;
34603461
bool eq(const Item *, bool binary_cmp) const override;
34613462
/* The following should be safe, even if we compare doubles */
34623463
longlong val_int() override {

0 commit comments

Comments
 (0)