server icon indicating copy to clipboard operation
server copied to clipboard

MDEV-32083 INSERT..SELECT crashes if target table appears in a derive…

Open Olernov opened this issue 8 months ago • 0 comments

…d table within the SELECT clause

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

Description

The cause if the problem is an outdated value of JOIN::tmp_table_param::field_count after derived table materialization.

JOIN::tmp_table_param is initialized during count_field_types() (join preparation phase). A derived table may be marked as merged at this point, but later it may be forced to materialization. Materialized derived table provides other values for JOIN::tmp_table_param, so it is necessary to re-calculate them after switch to materialization

Release Notes

How can this PR be tested?

./mtr insert_select

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 Mar 25 '25 13:03 Olernov