mirror of https://github.com/MariaDB/server
Browse Source
If one of the selected field is a MIN or MAX and it has been optimized into a constant, it is not added to the temp table used by a group by handler (GBH). The GBH therefore cannot store results to this missing field. On the other hand, when SELECTing from a view or a derived table, TMP_TABLE_ALL_COLUMNS is set. If the query has no group by or order by, an Item_temptable_field is created for this MIN/MAX field and added to the JOIN. Since the GBH could not store results to the corresponding field in the temp table, the value of this Item_temptable_field remains NULL. And the NULL value is passed to the record, then the temp row, and finally output as the (wrong) result. To fix this, we opt to not creating a spider GBH when a view or derived table is involved. This fixes spider/bugfix.mdev_26345 for --view-protocol Also fixed a comment: TABLE_LIST::belong_to_derived is NULL if the table belongs to a derived table that has non-MERGE type.bb-10.5-MDEV-31477
5 changed files with 19 additions and 1 deletions
Loading…
Reference in new issue