diff options
author | Oystein Grovlen <oystein.grovlen@oracle.com> | 2011-01-12 10:37:15 +0100 |
---|---|---|
committer | Oystein Grovlen <oystein.grovlen@oracle.com> | 2011-01-12 10:37:15 +0100 |
commit | 651313bf91d7771831de7228bb4130f0ac64c33a (patch) | |
tree | 8dda33b10566c0d88fa42759cbbecfcf39d4e314 /sql/sql_select.cc | |
parent | 83b4e920e20f9cf4abb0312bae6fc01a9f3cd307 (diff) | |
download | mariadb-git-651313bf91d7771831de7228bb4130f0ac64c33a.tar.gz |
Bug#59211: Select Returns Different Value for min(year) Function
get_year_value() contains code to convert 2-digits year to
4-digits. The fix for Bug#49910 added a check on the size of
the underlying field so that this conversion is not done for
YEAR(4) values. (Since otherwise one would convert invalid
YEAR(4) values to valid ones.)
The existing check does not work when Item_cache is used, since
it is not detected when the cache is based on a Field. The
reported change in behavior is due to Bug#58030 which added
extra cached items in min/max computations.
The elegant solution would be to implement
Item_cache::real_item() to return the underlying Item.
However, some side effects are observed (change in explain
output) that indicates that such a change is not straight-
forward, and definitely not appropriate for an MRU.
Instead, a Item_cache::field() method has been added in order
to get access to the underlying field. (This field() method
eliminates the need for Item_cache::eq_def() used in
test_if_ref(), but in order to limit the scope of this fix,
that code has been left as is.)
mysql-test/r/type_year.result:
Added test case for Bug#59211.
mysql-test/t/type_year.test:
Added test case for Bug#59211.
sql/item.h:
Added function Item_cache::field() to get access to the
underlying Field of a cached field Value.
sql/item_cmpfunc.cc:
Also check underlying fields of Item_cache, not just Item_Field,
when checking whether the value is of type YEAR(4) or not.
Diffstat (limited to 'sql/sql_select.cc')
0 files changed, 0 insertions, 0 deletions