From 4db726c0fa37ae57054a1b2530a83c278b33f538 Mon Sep 17 00:00:00 2001 From: Chaithra Gopalareddy Date: Sun, 14 Apr 2013 07:30:49 +0530 Subject: Bug#16347426:ASSERTION FAILED: (SELECT_INSERT && !TABLES->NEXT_NAME_RESOLUTION_TABLE) || !TAB Problem: The context info of select query gets corrupted when a query with group_concat having order by is present in an order by clause of the select query. As a result, server crashes with an assert. Analysis: While parsing order by for group_concat, it is presumed that it is always present before the actual order by for the select query. As a result, parser uses select->order_list to populate the order by items of group_concat and creates a select->gorder_list to which select->order_list is copied onto. Once this is done, it empties the select->order_list. In the case presented in the bugpage, as order by is already parsed when group_concat's order by is encountered, parser presumes that it is the second order by in the select query and creates fake_lex_unit which results in the change of context info. Solution: Make group_concat's order by parsing independent of the select --- sql/sql_lex.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sql/sql_lex.h') diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 0a054ced98a..2036707312a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -628,7 +628,7 @@ public: const char *type; /* type of select for EXPLAIN */ SQL_I_List order_list; /* ORDER clause */ - SQL_I_List *gorder_list; + SQL_I_List gorder_list; Item *select_limit, *offset_limit; /* LIMIT clause parameters */ // Arrays of pointers to top elements of all_fields list Item **ref_pointer_array; @@ -763,6 +763,7 @@ public: bool add_group_to_list(THD *thd, Item *item, bool asc); bool add_ftfunc_to_list(Item_func_match *func); bool add_order_to_list(THD *thd, Item *item, bool asc); + bool add_gorder_to_list(THD *thd, Item *item, bool asc); TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, ulong table_options, -- cgit v1.2.1