diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 1568409fe04..bb95627ceae 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -9,6 +9,8 @@ bool Window_spec::check_window_names(List_iterator_fast &it) { + if (window_names_are_checked) + return false; char *name= this->name(); char *ref_name= window_reference(); it.rewind(); @@ -54,6 +56,7 @@ Window_spec::check_window_names(List_iterator_fast &it) my_error(ER_WRONG_WINDOW_SPEC_NAME, MYF(0), ref_name); return true; } + window_names_are_checked= true; return false; } diff --git a/sql/sql_window.h b/sql/sql_window.h index f5f4216f786..53bd19f8bd6 100644 --- a/sql/sql_window.h +++ b/sql/sql_window.h @@ -88,6 +88,8 @@ public: class Window_spec : public Sql_alloc { + bool window_names_are_checked; + public: LEX_STRING *window_ref; @@ -104,8 +106,9 @@ class Window_spec : public Sql_alloc SQL_I_List *part_list, SQL_I_List *ord_list, Window_frame *win_frame) - : window_ref(win_ref), partition_list(part_list), order_list(ord_list), - window_frame(win_frame), referenced_win_spec(NULL) {} + : window_names_are_checked(false), window_ref(win_ref), + partition_list(part_list), order_list(ord_list), + window_frame(win_frame), referenced_win_spec(NULL) {} virtual char *name() { return NULL; }