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
Venkata Sidagam aef1982be0 Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE
Problem description:
Table 't' created with two colums having compound index on both the 
columns under innodb/myisam engine at remote machine. In the local 
machine same table is created undet the federated engine.
A select having where clause with along 'AND' operation gives wrong 
results on local machine.

Analysis: 
The given query at federated engine is wrongly transformed by 
federated::create_where_from_key() function and the same was sent to 
the remote machine. Hence the local machine is showing wrong results.

Given query "select c1 from t where c1 <= 2 and c2 = 1;"
Query transformed, after ha_federated::create_where_from_key() function is:
SELECT `c1`, `c2` FROM `t` WHERE  (`c1` IS NOT NULL ) AND 
( (`c1` >= 2)  AND  (`c2` <= 1) ) and the same sent to real_query().
In the above the '<=' and '=' conditions were transformed to '>=' and 
'<=' respectively.

ha_federated::create_where_from_key() function behaving as below:
The key_range is having both the start_key and end_key. The start_key 
is used to get "(`c1` IS NOT NULL )" part of the where clause, this 
transformation is correct. The end_key is used to get "( (`c1` >= 2) 
AND  (`c2` <= 1) )", which is wrong, here the given conditions('<=' and '=') 
are changed as wrong conditions('>=' and '<=').
The end_key is having {key = 0x39fa6d0 "", length = 10, keypart_map = 3, 
flag = HA_READ_AFTER_KEY}

The store_length is having value '5'. Based on store_length and length 
values the condition values is applied in HA_READ_AFTER_KEY switch case.
The switch case 'HA_READ_AFTER_KEY' is applicable to only the last part of 
the end_key and for previous parts it is going to 'HA_READ_KEY_OR_NEXT' case, 
here the '>=' is getting added as a condition instead of '<='.

Fix:
Updated the 'if' condition in 'HA_READ_AFTER_KEY' case to affect for all 
parts of the end_key. i.e 'i > 0' will used for end_key, Hence added it in 
the if condition.


mysql-test/suite/federated/federated.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_archive.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_13118.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_25714.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_bug_35333.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_debug.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_innodb.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_server.test:
  modified the federated.inc file location
mysql-test/suite/federated/federated_transactions.test:
  modified the federated.inc file location
mysql-test/suite/federated/include/federated.inc:
  moved the file from federated suite to federated/include folder
mysql-test/suite/federated/include/federated_cleanup.inc:
  moved the file from federated suite to federated/include folder
mysql-test/suite/federated/include/have_federated_db.inc:
  moved the file from federated suite to federated/include folder
storage/federated/ha_federated.cc:
  updated the 'if condition' in ha_federated::create_where_from_key() 
  function.
2012-07-26 15:09:22 +05:30
.bzr-mysql merge mysql-5.0-security->mysql-5.1-security 2011-08-17 13:25:33 +03:00
BitKeeper Merge trift2.:/MySQL/M51/mysql-5.1 2008-01-28 15:16:40 +01:00
BUILD Updated/added copyright headers 2011-06-30 17:37:13 +02:00
client Bug #12615411 - server side help doesn't work as first statement 2012-07-19 13:52:34 +05:30
cmd-line-utils Fixes required to build on AIX 2012-01-11 18:40:29 +01:00
config/ac-macros Bug#57991: Compiler flag change build error : adler32.c 2010-12-07 13:06:20 -02:00
dbug Merge 2010-12-29 00:47:05 +01:00
Docs Makefile.am: 2008-04-08 11:44:18 +02:00
extra Bug #11761822: yassl rejects valid certificate which openssl accepts 2012-05-15 13:12:22 +03:00
include Bug #13708485: malformed resultset packet crashes client 2012-06-28 18:38:55 +03:00
libmysql Bug #13708485: malformed resultset packet crashes client 2012-06-28 18:38:55 +03:00
libmysql_r Merge from mysql-5.0-bugteam. 2010-11-24 13:07:37 +03:00
libmysqld mysql_client_test did not build within limbysqld/examples 2012-07-10 10:04:57 +02:00
man Updated/added copyright headers 2011-06-30 17:37:13 +02:00
mysql-test Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE 2012-07-26 15:09:22 +05:30
mysys BUG#11762670:MY_B_WRITE RETURN VALUE IGNORED 2012-07-10 14:23:17 +05:30
netware Bug #45058 init_available_charsets uses double checked locking 2009-12-12 19:11:25 +01:00
plugin Updated/added copyright headers 2011-07-03 17:47:37 +02:00
regex Updated/added copyright headers 2011-06-30 17:37:13 +02:00
scripts Updated/added copyright headers 2012-02-15 17:21:38 +01:00
server-tools Updated/added copyright headers 2011-06-30 17:37:13 +02:00
sql Fixing wrong copyright. Index.xml was modified in 2005, 2012-07-24 09:27:00 +04:00
sql-bench Updated/added copyright headers 2011-06-30 17:37:13 +02:00
sql-common Bug #13708485: malformed resultset packet crashes client 2012-06-28 18:38:55 +03:00
storage Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE 2012-07-26 15:09:22 +05:30
strings Bug #13889741: HANDLE_FATAL_SIGNAL IN _DB_ENTER_ | 2012-07-05 13:41:16 +03:00
support-files Fix bug#11886309: RPM UPGRADE OF MYSQL ADVANCED GPL TO MYSQL SERVER ADVANCED DOES NOT WORK 2011-10-04 15:58:19 +02:00
tests mysql_client_fw.c was not included in make dist 2012-07-10 11:57:24 +02:00
unittest Updated/added copyright headers 2012-02-15 17:21:38 +01:00
vio Bug #11761822: yassl rejects valid certificate which openssl accepts 2012-05-15 13:12:22 +03:00
win Updated/added copyright headers 2011-07-03 17:47:37 +02:00
zlib The header "config.h" needs to be included "early" to control other headers. 2008-10-13 14:23:39 +02:00
.bzrignore merge 2011-04-20 18:00:50 +02:00
.cvsignore Import changeset 2000-07-31 21:29:14 +02:00
CMakeLists.txt Bug #14035452 - MODULARIZE MYSQL_CLIENT_TEST 2012-07-19 12:57:36 +02:00
configure.in Reverting broken configure/make stuff 2012-07-19 15:55:41 +02:00
COPYING Use a new version of "COPYING", the GPL text. 2010-03-04 14:26:27 +01:00
INSTALL-SOURCE ReadMe.txt, INSTALL-WIN-SOURCE, INSTALL-BINARY, INSTALL-SOURCE: 2007-11-23 10:15:55 +01:00
INSTALL-WIN-SOURCE ReadMe.txt, INSTALL-WIN-SOURCE, INSTALL-BINARY, INSTALL-SOURCE: 2007-11-23 10:15:55 +01:00
Makefile.am Reverting broken configure/make stuff 2012-07-19 15:55:41 +02:00
README Upmerge the copyright year change, from 5.0 to 5.1. 2012-02-28 12:44:21 +01:00

MySQL Server 5.1

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, 2012, 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.