Assertion marked_for_read() failed in virtual my_time_t Field_timesta…#5201
Open
pranavktiwari wants to merge 1 commit into
Open
Assertion marked_for_read() failed in virtual my_time_t Field_timesta…#5201pranavktiwari wants to merge 1 commit into
pranavktiwari wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new processor check_field_ref_processor to check for field references in Item and Item_field classes, and updates Type_handler_datetime_common::convert_item_for_comparison to utilize it. The review feedback suggests breaking down a long, complex conditional statement in sql/sql_type.cc into multiple lines to improve readability.
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.
…Field_timestamp0::get_timestamp(const uchar*, ulong*) const. add find_field_processor() to Item, overridden in Item_field to return true, and guard convert_item_for_comparison() with a walk() check to skip evaluation if the subject contains any field reference.
dedce87 to
90f303e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes MDEV-34992
Problem:
SELECTon a table with aTIMESTAMPcolumn and a virtual columnexpression containing a field reference crashes with assertion
marked_for_read()inField_timestamp0::get_timestamp.Cause:
convert_item_for_comparison()physically evaluates the subject itemvia
Datetime dt(thd, subject, ...)to attempt a TIMESTAMP vs DATETIMEoptimization. During
vcol_fix_expr()atopen_table()time,used_tables_cacheis not yet propagated up the item tree, causingconst_item()to returntrueincorrectly for a non-constant expressioncontaining a field reference. The evaluation then reads
Field_timestamp0before read bitmaps are initialized, violating
marked_for_read().Fix:
Add
find_field_processor()to theItembase class, overridden inItem_fieldto returntrue. Guardconvert_item_for_comparison()witha
walk()check to skip physical evaluation if the subject subtreecontains any field reference.