You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#35730982: GROUP_CONCAT results were displayed as NULL before 8.0.23
This is a regression from changes made in the fix for bug#32053547.
In this fix, a check for NULL value in group concat evaluation was
moved from Item_func_group_concat::setup() to fix_fields(). The change
made sense, however when a table was subject to const table elimination,
it was no longer optimized early. It would still have been OK, except
that the NULL value check in Item_func_group_concat::add() does not
cover all possible cases and thus a NULL value in an underlying argument
to group_concat might not be detected.
The fix is to reintroduce a NULL value check in the setup() function,
while still keeping the check in fix_fields(). The flag always_null is
replaced by two flags m_null_resolved which is set in fix_fields() and
m_null_executed which is set in setup(). The former handles expressions
that are always NULL, whereas the latter handles expressions that can be
determined to be NULL at start of each execution.
The two flags are also moved to the base class Item_sum so that the same
optimization may easily be added for other aggregate functions.
The flag m_null_executed is reset in Item_sum::cleanup() so that it can
be evaluated properly in start of next execution, when used with
prepared statements.
A specific test case using a prepared statement is added to verify that
the flag is properly cleared for subsequent executions.
Change-Id: I42967ee5908d5e288854463b6b761a049dc7a7ee
0 commit comments