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
unknown 7bb6a72593 Bug#27590: Wrong DATE/DATETIME comparison.
DATE and DATETIME can be compared either as strings or as int. Both
methods have their disadvantages. Strings can contain valid DATETIME value
but have insignificant zeros omitted thus became non-comparable with
other DATETIME strings. The comparison as int usually will require conversion
from the string representation and the automatic conversion in most cases is
carried out in a wrong way thus producing wrong comparison result. Another
problem occurs when one tries to compare DATE field with a DATETIME constant.
The constant is converted to DATE losing its precision i.e. losing time part.

This fix addresses the problems described above by adding a special
DATE/DATETIME comparator. The comparator correctly converts DATE/DATETIME
string values to int when it's necessary, adds zero time part (00:00:00)
to DATE values to compare them correctly to DATETIME values. Due to correct
conversion malformed DATETIME string values are correctly compared to other
DATE/DATETIME values.

As of this patch a DATE value equals to DATETIME value with zero time part.
For example '2001-01-01' equals to '2001-01-01 00:00:00'.

The compare_datetime() function is added to the Arg_comparator class.
It implements the correct comparator for DATE/DATETIME values.
Two supplementary functions called get_date_from_str() and get_datetime_value()
are added. The first one extracts DATE/DATETIME value from a string and the
second one retrieves the correct DATE/DATETIME value from an item.
The new Arg_comparator::can_compare_as_dates() function is added and used
to check whether two given items can be compared by the compare_datetime()
comparator.
Two caching variables were added to the Arg_comparator class to speedup the
DATE/DATETIME comparison.
One more store() method was added to the Item_cache_int class to cache int
values.
The new is_datetime() function was added to the Item class. It indicates
whether the item returns a DATE/DATETIME value.


sql/item.cc:
  Bug#27590: Wrong DATE/DATETIME comparison.
  One more store() method was added to the Item_cache_int class to cache int
  values.
  The new is_datetime() function was added to the Item class. It indicates
  whether the item returns a DATE/DATETIME value.
sql/item.h:
  Bug#27590: Wrong DATE/DATETIME comparison.
  One more store() method was added to the Item_cache_int class to cache int
  values.
  The new is_datetime() function was added to the Item class. It indicates
  whether the item returns a DATE/DATETIME value.
sql/item_cmpfunc.cc:
  Bug#27590: Wrong DATE/DATETIME comparison.
  The compare_datetime() function is added to the Arg_comparator class.
  It implements the correct comparator for DATE/DATETIME values.
  Two supplementary functions called get_date_from_str() and get_datetime_value()
  are added. The first one extracts DATE/DATETIME value from a string and the
  second one retrieves the correct DATE/DATETIME value from an item.
  The new Arg_comparator::can_compare_as_dates() function is added and used
  to check whether two given items can be compared by the compare_datetime()
  comparator.
sql/item_cmpfunc.h:
  Bug#27590: Wrong DATE/DATETIME comparison.
  The compare_datetime() function is added to the Arg_comparator class.
  It implements the correct comparator for DATE/DATETIME values.
  Two supplementary functions called get_date_from_str() and get_datetime_value()
  are added. The first one extracts DATE/DATETIME value from a string and the
  second one retrieves the correct DATE/DATETIME value from an item.
  The new Arg_comparator::can_compare_as_dates() function is added and used
  to check whether two given items can be compared by the compare_datetime()
  comparator.
  Two caching variables were added to the Arg_comparator class to speedup the
  DATE/DATETIME comparison.
mysql-test/include/ps_conv.inc:
  Test case adjusted after fix for bug#27590.
mysql-test/r/distinct.result:
  Test cases results are corrected after fix for bug#27590.
sql/sql_select.cc:
  Bug#27590: Wrong DATE/DATETIME comparison.
  The test_if_equality_guarantees_uniqueness() function now uses
  Arg_comparator::can_compare_as_dates() to detect comparable DATE/DATETIME items.
mysql-test/r/ps_2myisam.result:
  The result of the adjusted test case after fix for bug#27590.
mysql-test/r/ps_3innodb.result:
  The result of the adjusted test case after fix for bug#27590.
mysql-test/r/ps_4heap.result:
  The result of the adjusted test case after fix for bug#27590.
mysql-test/r/ps_5merge.result:
  The result of the adjusted test case after fix for bug#27590.
mysql-test/r/subselect.result:
  Test cases results are corrected after fix for bug#27590.
mysql-test/r/type_datetime.result:
  Added a test case for the bug#27590: Wrong DATE/DATETIME comparison.
mysql-test/t/type_datetime.test:
  Added a test case for the bug#27590: Wrong DATE/DATETIME comparison.
tests/mysql_client_test.c:
  Test case adjusted after fix for bug#27590.
2007-04-27 00:12:09 +04:00
bdb my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
BitKeeper Bug#25807: LOAD DATA INFILE does not work with Pipes 2007-02-13 16:35:29 -05:00
BUILD Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl 2007-03-29 12:25:28 +02:00
client Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0 2007-04-02 10:50:39 +02:00
cmd-line-utils Fixed compiler warnings. 2007-02-28 22:23:35 +02:00
config/ac-macros Bug#22378 Make error, strings/ctype-utf8.c, uni_plane undeclared 2007-03-27 15:06:41 +05:00
dbug Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2007-01-22 14:04:40 +02:00
Docs Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build 2007-03-22 19:43:41 +01:00
extra Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0 2007-04-02 10:50:39 +02:00
heap Merge bk-internal.mysql.com:/home/bk/mysql-5.0-engines 2007-03-22 21:34:31 +01:00
include Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb 2007-04-05 10:24:37 +02:00
innobase Apply innodb-5.0-ss1372 snapshot 2007-03-28 22:41:21 -06:00
libmysql Merge siva.hindu.god:/home/tsmith/m/bk/maint/mar05/50 2007-03-06 15:36:07 -07:00
libmysql_r my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
libmysqld Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2007-01-22 14:04:40 +02:00
man my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
myisam Merge pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint 2007-04-02 10:42:08 +02:00
myisammrg my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
mysql-test Bug#27590: Wrong DATE/DATETIME comparison. 2007-04-27 00:12:09 +04:00
mysys Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0 2007-04-02 10:50:39 +02:00
ndb Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb 2007-04-05 09:18:36 +02:00
netware Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build-work 2007-03-20 13:44:47 +01:00
os2 my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
pstack my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
regex my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
scripts Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0 2007-04-02 10:50:39 +02:00
server-tools Many files: 2007-03-19 16:18:10 +01:00
sql Bug#27590: Wrong DATE/DATETIME comparison. 2007-04-27 00:12:09 +04:00
sql-bench my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
sql-common Merge pilot.blaudden:/home/msvensson/mysql/bug24121/my50-bug24121 2007-03-29 13:37:40 +02:00
SSL my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
strings Code layout fix for bug N 27079 2007-03-29 10:32:38 +05:00
support-files Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build 2007-03-27 17:51:30 +02:00
tests Bug#27590: Wrong DATE/DATETIME comparison. 2007-04-27 00:12:09 +04:00
tools Fixed compiler warnings (for linux and win32 and win64) 2007-02-22 16:59:57 +02:00
VC++Files vio.vcproj, mysqld.vcproj, mysys.vcproj, libmysqld.vcproj, mysqldemb.vcproj: 2007-03-20 15:12:50 +01:00
vio Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23 2007-03-28 12:23:55 +02:00
win configure.in: 2007-03-28 23:00:50 +02:00
zlib my_strtoll10-x86.s: 2006-12-31 01:02:27 +01:00
.bzrignore Merge bk-internal:/home/bk/mysql-5.0-maint 2007-03-21 14:30:47 +01:00
.cvsignore
CMakeLists.txt configure.in: 2007-03-28 23:00:50 +02:00
configure.in configure.in: 2007-03-28 23:00:50 +02:00
configure.in.rej Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-4.0 2007-01-22 03:33:59 +02:00
COPYING - manual.texi will be replaced with a manual written in DocBook/XML. This ChangeSet removes all 2005-04-13 11:51:38 +02:00
EXCEPTIONS-CLIENT EXCEPTIONS-CLIENT: 2007-03-14 18:28:16 +01:00
Makefile.am Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build 2007-03-27 17:51:30 +02:00
README make_binary_distribution.sh: 2006-11-07 22:26:37 +01:00

This is a release of MySQL, a dual-license SQL database server.
MySQL is brought to you by the MySQL team at MySQL AB.

License information can be found in these files:
- For GPL (free) distributions, see the COPYING file and
  the EXCEPTIONS-CLIENT file.
- For commercial distributions, see the LICENSE.mysql file.


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 manual sections of special interest:

- If you are migrating from an older version of MySQL, please read the
  "Upgrading from..." section first!
- 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 Change History appendix.
- For the currently known bugs/misfeatures (known errors) see the Problems
  and Common Errors appendix.
- For a list of developers and other contributors, see the Credits
  appendix.

A local copy of the MySQL Reference Manual can be found in the Docs
directory in GNU Info format.  You can also browse the manual online or
download it in any of several formats at the URL given earlier in this
file.

************************************************************

IMPORTANT:

Bug or error reports should be sent to http://bugs.mysql.com.