-
unknown authored
When merging views into the enclosing statement the ORDER BY clause of the view is merged to the parent's ORDER BY clause. However when the VIEW is merged into an UNION branch the ORDER BY should be ignored. Use of ORDER BY for individual SELECT statements implies nothing about the order in which the rows appear in the final result because UNION by default produces unordered set of rows. Fixed by ignoring the ORDER BY clause from the merge view when expanded in an UNION branch. mysql-test/r/view.result: Bug #27786: test case mysql-test/t/view.test: Bug #27786: test case sql/sql_lex.h: Bug #27786: add a is_union() inlined function Returns true if the unit represents an UNION. sql/sql_view.cc: Bug #27786: ignore ORDER BY in mergeable views when in UNION context
e0444ba4