MDEV-32401 expression cache lead to crash if table of wrong type created and the cache switched off - #5727
MDEV-32401 expression cache lead to crash if table of wrong type created and the cache switched off#5727forkfun wants to merge 3 commits into
Conversation
…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;"
|
|
There was a problem hiding this comment.
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
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 broaderresult_fieldinvariant.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.
| 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. |
|
Generally, looks like a step in the right direction. I had considered splitting @sanja-byelkin , could you please check those two commits (also pushed into this PR, BB doesn't show any hits for the assertion): Any objections? |

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