MDEV-24658: Optimizer trace reads a column not marked for read#5321
MDEV-24658: Optimizer trace reads a column not marked for read#5321DaveGosselin-MariaDB wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request addresses MDEV-24658 where the optimizer trace reads a column not marked for read. The fix updates Field::marked_for_read() in sql/field.cc to return true if the table is a constant table (table->const_table), as its row is read during optimization and remains materialized in record[0]. Additionally, a corresponding test case has been added to mysql-test/main/opt_trace.test and its expected output updated in mysql-test/main/opt_trace.result. There are no review comments to address, and I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
When the optimizer trace is enabled, it's safe to read from a constant table because the value in record[0] was materialized during optimization and remains available, even after constants propagation has removed the table from the read set.
91fe17e to
80cc8d3
Compare
When the optimizer trace is enabled, it's safe to read from a constant table because the value in record[0] was materialized during optimization and remains available, even after constants propagation has removed the table from the read set.