Details
-
Bug
-
Status: Stalled (View Workflow)
-
Critical
-
Resolution: Unresolved
-
12.3, 13.2
Description
Problem
SELECT TO_NUMBER(NULL, NULL) makes a debug build abort in Protocol::end_statement(): the statement finished without OK, EOF or ERROR set in the diagnostics area.
How to repeat
Default sql_mode, no table:
SELECT TO_NUMBER(NULL, NULL); |
Actual result
Debug build, SIGABRT:
sql/protocol.cc:639: void Protocol::end_statement(): Assertion `0' failed.
|
Protocol::end_statement()
|
dispatch_command(enum_server_command, THD*, char*, unsigned int, bool)
|
do_command(THD*, bool)
|
The assertion is the DA_EMPTY / default branch of the switch in Protocol::end_statement(). On a build without assertions the same branch falls through to send_ok(), there is no crash, and the client prints no result for the statement. Expected in both cases: a result set with one row containing NULL.
Notes
Found by calling every server function with one to three NULL arguments: this was the only crash among about 500 functions, and only with two arguments. I did not investigate the root cause (the format argument is a constant NULL; Item_func_to_number in sql/item_numconvfunc.cc caches a constant format at fix time, which is where I would look first, but I did not verify it). The code is unchanged on current main (checked against 52391ebe4feb56c8ccbbf33a29ea3acbb7b7cea7).