• MySQL Build Team's avatar
    Backport into build-201102032246-5.1.52sp1 · 9b656643
    MySQL Build Team authored
    > ------------------------------------------------------------
    > revno: 3452.13.54
    > revision-id: oystein.grovlen@oracle.com-20110112093715-tc076voaxwblqk8v
    > parent: georgi.kodinov@oracle.com-20110110130833-1c9q21mr7zoq07vg
    > committer: Oystein Grovlen <oystein.grovlen@oracle.com>
    > branch nick: mysql-5.1-security
    > timestamp: Wed 2011-01-12 10:37:15 +0100
    > message:
    >   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.)
    9b656643
item_cmpfunc.cc 144 KB