mariadb/mysql-test/suite
Olav Sandstaa fd5380b496 Fix for Bug#14636211 WRONG RESULT (EXTRA ROW) ON A FROM SUBQUERY
WITH A VARIABLE AND ORDER BY
        Bug#16035412 MYSQL SERVER 5.5.29 WRONG SORTING USING COMPLEX INDEX
      
This is a fix for a regression introduced by Bug#12667154:
Bug#12667154 attempted to fix a performance problem with subqueries
that did filesort. For doing filesort, the optimizer creates a quick
select object to use when building the sort index. This quick select
object was deleted after the first call to create_sort_index(). Thus,
for queries where the subquery was executed multiple times, the quick
object was only used for the first execution. For all later executions
of the subquery, filesort used a complete table scan for building the
sort index. The fix for Bug#12667154 tried to fix this by not deleting
the quick object after the first execution of create_sort_index() so
that it would be re-used for building the sort index by the following
executions of the subquery.
      
This regression introduced in Bug#12667154 is that due to not deleting
the quick select object after building the sort index, the quick
object could in some cases be used also during the second phase of the
execution of the subquery instead of using the created sort
index. This caused wrong results to be returned.
      
The fix for this issue is to delete the reference to the select object
after it has been used in create_sort_index(). In this way the select 
and quick objects will not be available when doing the second phase
of the execution of the select operation. To ensure that the select
object can be re-used for the following executions of the subquery
we make a copy of the select pointer. This is used for restoring the
select object after the select operation is completed.


mysql-test/suite/innodb/r/innodb_mysql.result:
  Changed explain output: The explain now contains "Using where" since we
  have restored the select pointer after doing the filesort operation.
sql/sql_select.cc:
  Change create_sort_index() so that it always sets the pointer to
  the select object to NULL. This is done in order to avoid that the
  select->quick object can be used when execution the main part of
  the select operation.
sql/sql_select.h:
  New member in JOIN_TAB: saved_select. Used by create_sort_index to
  make a backup copy of the select pointer.
2013-01-14 10:58:17 +01:00
..
binlog BUG#15891524: RLI_FAKE MODE IS NOT UNSET AFTER BINLOG REPLAY 2012-11-20 12:37:23 +00:00
engines BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE RPL_ROW_UNTIL TIMES OUT 2012-12-09 17:26:44 +05:30
federated Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE 2012-07-26 15:29:19 +05:30
funcs_1 Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE 2012-07-26 23:27:01 +05:30
funcs_2 Changed to Oracle bug numbers 2011-05-24 12:08:13 +05:30
innodb Fix for Bug#14636211 WRONG RESULT (EXTRA ROW) ON A FROM SUBQUERY 2013-01-14 10:58:17 +01:00
jp WL#2360 Performance schema 2010-01-11 18:47:27 -07:00
large_tests BUG#11877618: rpl_slave_net_timeout fails in rpl_sync.inc (at sync_slave_with_master) 2011-03-17 11:31:42 +01:00
manual BUG#49978: Replication tests don't clean up replication state at the end 2010-12-19 18:07:28 +01:00
parts Bug#11751825 - OPTIMIZE PARTITION RECREATES FULL TABLE INSTEAD JUST PARTITION 2012-11-08 14:23:02 +05:30
perfschema Bug#16060864 SEGMENTATION FAULT IN PERFORMANCE_SCHEMA WITH HISTORY SIZE 0 2013-01-02 11:00:55 +01:00
perfschema_stress Removing copyright headers from test files 2011-10-19 23:44:17 +02:00
rpl BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE 2012-12-09 15:50:32 +05:30
stress Bug #11751927 42960: MTR2: NO MORE --STRESS PARAMETERS 2011-09-15 12:34:32 +02:00
sys_vars Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION 2012-11-28 17:07:02 +09:00