-
unknown authored
Problem: Segmentation fault in add_group_and_distinct_keys() when accessing field of what is assumed to be an Item_field object. Cause: In case of views, the item added to list by is_indexed_agg_distinct() was not of type Item_field, but Item_ref. Resolution: Add the real Item_field object, the one referred to by Item_ref object, to the list, instead. mysql-test/r/count_distinct.result: Results for test case for Bug#51980. mysql-test/t/count_distinct.test: Test case for Bug#51980. Table needs to contain at least two rows to avoid const table optimization. sql/sql_select.cc: Make sure it is the actual Item_field object that is pushed to the out_args list of is_indexed_agg_distinct(), and not Item_ref objects.
6a5b47a4