MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
Find a file
Chaithra Gopalareddy 8ade414b28 Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY
Problem:
If there is a predicate on a column referenced by MIN/MAX and
that predicate is not present in all the disjunctions on
keyparts earlier in the compound index, Loose Index Scan will
not return correct result.

Analysis:
When loose index scan is chosen, range optimizer currently
groups all the predicates that contain group parts separately
and minmax parts separately. It therefore applies all the
conditions on the group parts first to the fetched row.
Then in the call to next_max, it processes the conditions
which have min/max keypart.

For ex in the following query:
Select f1, max(f2) from t1 where (f1 = 10 and f2 = 13) or
(f1 = 3) group by f1;
Condition (f2 = 13) would be applied even for rows that
satisfy (f1 = 3) thereby giving wrong results.

Solution:
Do not choose loose_index_scan for such cases. So a new rule
WA2 is introduced to take care of the same.

WA2: "If there are predicates on C, these predicates must
be in conjuction to all predicates on all earlier keyparts
in I."

Todo the same, fix reuses the function get_constant_key_infix().
Since this funciton will fail for all multi-range conditions, it
is re-written to recognize that if the sub-conditions are
equivalent across the disjuncts: it will now succeed.
And to achieve this a new helper function is introduced called
all_same().

The fix also moves the test of NGA3 up to the former only
caller, get_constant_key_infix().


mysql-test/r/group_min_max_innodb.result:
  Added test result change for Bug#17909656
mysql-test/t/group_min_max_innodb.test:
  Added test cases for Bug#17909656
sql/opt_range.cc:
  Introduced Rule WA2 because of Bug#17909656
2014-05-07 14:59:23 +05:30
.bzr-mysql Fix tree setup: Wrong mailing list for commit mails. 2012-03-20 22:32:10 +01:00
BUILD Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
client Bug #18186103 BUFFER OVERFLOW IN CLIENT 2014-02-12 15:17:37 +05:30
cmake Backport from trunk: 2014-05-05 16:39:14 +02:00
cmd-line-utils Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
dbug BUG#16402143 - STACK CORRUPTION IN DBUG_EXPLAIN 2013-04-10 11:50:41 +05:30
Docs Merging the changes for Bug 16633169 - MYSQL.INFO CONTAINS OUTDATED INFORMATION. 2013-04-16 12:17:18 +02:00
extra Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
include BUG#18080920: CRASH; MY_REALLOC_STR DEREFERENCES NEGATIVE VALUE 2014-04-24 09:30:21 +05:30
libmysql BUG#18080920: CRASH; MY_REALLOC_STR DEREFERENCES NEGATIVE VALUE 2014-04-24 09:30:21 +05:30
libmysqld Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
libservices Updated/added copyright headers 2011-06-30 17:46:53 +02:00
man Exclude NDB man pages from a source tarball, 2011-10-04 12:28:30 +02:00
mysql-test Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY 2014-05-07 14:59:23 +05:30
mysys Bug #17514920 MYSQL_THREAD_INIT() CALL WITHOUT MYSQL_INIT() IS CRASHING IN WINDOWS 2014-04-23 12:46:00 +03:00
packaging - Support for enterprise packages 2014-04-24 11:06:02 +02:00
plugin Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
regex BUG#14303860 - EXECUTING A SELECT QUERY WITH TOO 2013-01-14 16:51:52 +05:30
scripts Bug#18235669 MYSQL_CONFIG TO PROVIDE R FLAG ON SOLARIS 2014-02-25 09:07:44 +01:00
sql Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY 2014-05-07 14:59:23 +05:30
sql-bench Bug #13004581 BLACKHOLE BINARY LOG WITH ROW IGNORES UPDATE AND DELETE STATEMENTS 2013-04-27 16:04:54 +08:00
sql-common Bug #18053212 MYSQL_GET_SERVER_VERSION() CALL WITHOUT A VALID CONNECTION RESULTS IN SEG FAULT 2014-04-17 16:33:55 +03:00
storage Description: When we execute a correlated subquery on an 2014-04-10 11:10:31 +05:30
strings Bug #17760379 COLLATIONS WITH CONTRACTIONS BUFFER-OVERFLOW THEMSELVES IN THE FOOT 2014-01-11 14:48:29 +05:30
support-files Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
tests Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
unittest Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
vio Updated/added copyright headers 2014-01-06 10:52:35 +05:30
win Updated/added copyright headers 2011-06-30 17:46:53 +02:00
zlib Updated/added copyright headers 2014-01-06 10:52:35 +05:30
.bzrignore A bit more intelligent processing of .in files in mysql-test/collections 2013-01-15 09:56:36 +01:00
BUILD-CMAKE Updated/added copyright headers 2011-06-30 17:46:53 +02:00
CMakeLists.txt Backport of: 2014-03-05 13:01:54 +01:00
config.h.cmake Bug#16316074 RFE: MAKE TMPDIR A BUILD-TIME CONFIGURABLE OPTION 2013-12-18 11:05:18 +01:00
configure.cmake Bug#17296644 CONV(X, INT_MIN, INT_MIN) SEGFAULTS THE SERVER 2013-09-09 14:20:50 +02:00
COPYING Use a new version of "COPYING", the GPL text. 2010-03-04 14:26:27 +01:00
INSTALL-SOURCE Merging the changes for Bug 16633169 - MYSQL.INFO CONTAINS OUTDATED INFORMATION. 2013-04-16 12:17:18 +02:00
INSTALL-WIN-SOURCE Merging the changes for Bug 16633169 - MYSQL.INFO CONTAINS OUTDATED INFORMATION. 2013-04-16 12:17:18 +02:00
README Updated/added copyright headers 2014-01-06 10:52:35 +05:30
VERSION Raise version number after cloning 5.5.38 2014-05-05 12:15:12 +02:00

MySQL Server 5.5

This is a release of MySQL, a dual-license SQL database server.
For the avoidance of doubt, this particular copy of the software 
is released under the version 2 of the GNU General Public License. 
MySQL is brought to you by Oracle.

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

License information can be found in the COPYING file.

MySQL FOSS License Exception
We want free and open source software applications under certain
licenses to be able to use specified GPL-licensed MySQL client
libraries despite the fact that not all such FOSS licenses are
compatible with version 2 of the GNU General Public License.  
Therefore there are special exceptions to the terms and conditions 
of the GPLv2 as applied to these client libraries, which are 
identified and described in more detail in the FOSS License 
Exception at 
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.

This distribution may include materials developed by third
parties. For license and attribution notices for these
materials, please refer to the documentation that accompanies
this distribution (see the "Licenses for Third-Party Components"
appendix) or view the online documentation at 
<http://dev.mysql.com/doc/>.

GPLv2 Disclaimer
For the avoidance of doubt, except that if any license choice
other than GPL or LGPL is available it will apply instead, 
Oracle elects to use only the General Public License version 2 
(GPLv2) at this time for any software where a choice of GPL 
license versions is made available with the language indicating 
that GPLv2 or any later version may be used, or where a choice 
of which version of the GPL is applied is otherwise unspecified.

For further information about MySQL or additional documentation, 
see:
- The latest information about MySQL: http://www.mysql.com
- The current MySQL documentation: http://dev.mysql.com/doc

Some Reference Manual sections of special interest:
- If you are migrating from an older version of MySQL, please 
  read the "Upgrading from..." section.
- To see what MySQL can do, take a look at the features section.
- For installation instructions, see the Installing and Upgrading
  chapter.
- For the new features/bugfix history, see the MySQL Change History 
  appendix.

You can browse the MySQL Reference Manual online or download it 
in any of several formats at the URL given earlier in this file.
Source distributions include a local copy of the manual in the
Docs directory.