Repository navigation
MDEV-42246 Assertion `0' failed in Protocol::end_statement() on SELECT TO_NUMBER(NULL, NULL) - #6150
Open
mehul-raj5 wants to merge 1 commit into
Open
mehul-raj5 wants to merge 1 commit into
mehul-raj5 wants to merge 1 commit into
Conversation
…T TO_NUMBER(NULL, NULL) When the format argument of TO_NUMBER() was a constant NULL, set_func_handler_for_const_format() made fix_length_and_dec() fail without raising an error. The statement was aborted with an empty diagnostics area, which hit the assertion in Protocol::end_statement(). Release builds sent an OK packet with no result set instead. A NULL format is not an error. Use the per-row format handler for it, which already returns NULL when the format is NULL.
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.
Description
When the format argument of TO_NUMBER() is a constant NULL,
set_func_handler_for_const_format()makesfix_length_and_dec()fail without raising an error. The statement is aborted with an empty diagnostics area, which hitsDBUG_ASSERT(0)inProtocol::end_statement(). Release builds send an OK packet with no result set instead.SELECT TO_NUMBER(NULL, NULL)NULLSELECT TO_NUMBER('1', NULL)NULLSELECT TO_NUMBER(NULL, '9')NULLNULLNULL(unchanged)A NULL format is not an error. The fix uses the per-row format handler for it, which already returns NULL when the format is NULL. Both queries now return NULL, and the result column is a nullable DOUBLE.
The out-of-memory case keeps returning an error, as before.