Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: 10.5
Choose a base branch
from

Conversation

Olernov
Copy link
Contributor

@Olernov Olernov commented Mar 25, 2025

…d table within the SELECT clause

  • 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.
  • 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

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

…d table within the SELECT clause

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant