Skip to content

MDEV-32401 expression cache lead to crash if table of wrong type created and the cache switched off - #5727

Open
forkfun wants to merge 1 commit into
11.4from
bb-11.4-MDEV-32401
Open

forkfun wants to merge 1 commit into
11.4from
bb-11.4-MDEV-32401

Conversation

@forkfun

@forkfun forkfun commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from 3d0ea3d (10.6 backport: #5492)

…ted and the cache switched off

1) take into account TMP_TABLE_ALL_COLUMNS when
   we are modifying agg_item->result_field
2) remove unused now "bool materialized_subquery;"
Copilot AI lite review requested due to automatic review settings September 21, 2026 15:38
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

One moderate documentation/invariant issue and two minor comment issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Fixes an expression-cache crash involving aggregate result_field handling for temporary tables.

Changes:

  • Controls aggregate field updates with TMP_TABLE_ALL_COLUMNS.
  • Removes obsolete materialized-subquery state.
  • Adds regression coverage for TEXT, CAST, and INT cases.

Review findings:

  • sql/sql_priv.h: nit (3 votes)—correct the typo and wording in the new comment.
  • sql/sql_priv.h: moderate (1 vote)—clarify or enforce the comment’s broader result_field invariant.
  • sql/sql_select.cc: nit (1 vote)—update stale rationale describing the removed condition.
File Reviewed change
sql/​sql_select.cc Adjusts aggregate result-field handling.
sql/​sql_priv.h Defines and documents the temporary-table option.
sql/​sql_class.h Removes obsolete state.
sql/​sql_class.cc Removes obsolete initialization.
sql/​item_subselect.cc Removes obsolete state assignment.
mysql-test/​main/​subselect_cache.test Adds regression queries.
mysql-test/​main/​subselect_cache.result Records expected results.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread sql/sql_priv.h
Comment on lines +62 to +64
Include all colums in temporary table, i.e. do not ignore aggregate and
constants, i.e. the temporary table created for other purposes than
aggregation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants