diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2006-04-25 17:02:49 +0200 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2006-04-25 17:02:49 +0200 |
commit | b4999513d127d6918fcc576c5393875e5b102d42 (patch) | |
tree | 87004ffbe313f402b2833c8cbfa0442ff15717ce /sql/sql_yacc.yy | |
parent | b784da04340daebef94158a0ba96667247af6dd5 (diff) | |
parent | ea564a7215b7267855892b3ef40898821d688ba5 (diff) | |
download | mariadb-git-b4999513d127d6918fcc576c5393875e5b102d42.tar.gz |
Merge perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d533aac9850..9f00af069d3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7363,14 +7363,32 @@ order_clause: ORDER_SYM BY { LEX *lex=Lex; - if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE && - lex->current_select->olap != - UNSPECIFIED_OLAP_TYPE) + SELECT_LEX *sel= lex->current_select; + SELECT_LEX_UNIT *unit= sel-> master_unit(); + if (sel->linkage != GLOBAL_OPTIONS_TYPE && + sel->olap != UNSPECIFIED_OLAP_TYPE) { my_error(ER_WRONG_USAGE, MYF(0), "CUBE/ROLLUP", "ORDER BY"); YYABORT; } + if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex) + { + /* + A query of the of the form (SELECT ...) ORDER BY order_list is + executed in the same way as the query + SELECT ... ORDER BY order_list + unless the SELECT construct contains ORDER BY or LIMIT clauses. + Otherwise we create a fake SELECT_LEX if it has not been created + yet. + */ + SELECT_LEX *first_sl= unit->first_select(); + if (!first_sl->next_select() && + (first_sl->order_list.elements || + first_sl->select_limit) && + unit->add_fake_select_lex(lex->thd)) + YYABORT; + } } order_list; order_list: |