diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b84a21b1440..4046aef892b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5267,9 +5267,12 @@ optional_order_or_limit: SELECT_LEX *sel= lex->current_select; SELECT_LEX_UNIT *unit= sel->master_unit(); SELECT_LEX *fake= unit->fake_select_lex; - unit->global_parameters= fake; - fake->no_table_names_allowed= 1; - lex->current_select= fake; + if (fake) + { + unit->global_parameters= fake; + fake->no_table_names_allowed= 1; + lex->current_select= fake; + } thd->where= "global ORDER clause"; } order_or_limit |