diff options
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 60 |
1 files changed, 12 insertions, 48 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 6def798b1c7..c8cc64dba7e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2915,6 +2915,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) { SELECT_LEX *sl= lex->all_selects_list; DBUG_ENTER("reinit_stmt_before_use"); + Window_spec *win_spec; /* We have to update "thd" pointer in LEX, all its units and in LEX::result, @@ -2983,6 +2984,17 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) /* Fix ORDER list */ for (order= sl->order_list.first; order; order= order->next) order->item= &order->item_ptr; + /* Fix window functions too */ + List_iterator<Window_spec> it(sl->window_specs); + + while ((win_spec= it++)) + { + for (order= win_spec->partition_list->first; order; order= order->next) + order->item= &order->item_ptr; + for (order= win_spec->order_list->first; order; order= order->next) + order->item= &order->item_ptr; + } + { #ifdef DBUG_ASSERT_EXISTS bool res= @@ -4206,30 +4218,6 @@ reexecute: error= execute(expanded_query, open_cursor) || thd->is_error(); thd->m_reprepare_observer= NULL; -#ifdef WITH_WSREP - - if (WSREP_ON) - { - mysql_mutex_lock(&thd->LOCK_thd_data); - switch (thd->wsrep_conflict_state) - { - case CERT_FAILURE: - WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %lld err: %d", - (longlong) thd->thread_id, - thd->get_stmt_da()->sql_errno() ); - thd->wsrep_conflict_state = NO_CONFLICT; - break; - - case MUST_REPLAY: - (void) wsrep_replay_transaction(thd); - break; - - default: - break; - } - mysql_mutex_unlock(&thd->LOCK_thd_data); - } -#endif /* WITH_WSREP */ if (unlikely(error) && (sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) && @@ -4402,30 +4390,6 @@ reexecute: error= execute(expanded_query, open_cursor) || thd->is_error(); thd->m_reprepare_observer= NULL; -#ifdef WITH_WSREP - - if (WSREP_ON) - { - mysql_mutex_lock(&thd->LOCK_thd_data); - switch (thd->wsrep_conflict_state) - { - case CERT_FAILURE: - WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %lld err: %d", - (longlong) thd->thread_id, - thd->get_stmt_da()->sql_errno() ); - thd->wsrep_conflict_state = NO_CONFLICT; - break; - - case MUST_REPLAY: - (void) wsrep_replay_transaction(thd); - break; - - default: - break; - } - mysql_mutex_unlock(&thd->LOCK_thd_data); - } -#endif /* WITH_WSREP */ if (unlikely(error) && (sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) && |