server icon indicating copy to clipboard operation
server copied to clipboard

MDEV-34880 Incorrect result for query with derived table having TEXT …

Open Olernov opened this issue 1 year ago • 3 comments

…field

  • [x] The Jira issue number for this PR is: MDEV-34880

Description

When a derived table which has distinct values and BLOB fields is materialized, an index is created over all columns to ensure only distinct values are placed to the result. This index is created in a special mode HA_UNIQUE_HASH to support BLOBs. Later in best_access_path the optimizer may incorrectly choose this index to retrieve values from the derived table, although such type of index cannot be used for data retrieval.

This commit excludes HA_UNIQUE_HASH indexes from consideration in best_access_path

Release Notes

TODO: What should the release notes say about this change? Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.

How can this PR be tested?

A test case is added to main/derived.test

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • [ ] This is a new feature or a refactoring, and the PR is based against the main branch.
  • [x] This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • [x] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • [x] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

Olernov avatar Sep 29 '24 14:09 Olernov