diff options
author | Anurag Shekhar <anurag.shekhar@sun.com> | 2010-04-02 01:35:36 +0530 |
---|---|---|
committer | Anurag Shekhar <anurag.shekhar@sun.com> | 2010-04-02 01:35:36 +0530 |
commit | ab8ff15cd148a0a5855d2474db78c05ec28f20c7 (patch) | |
tree | 9a3dc6ee077fbdb88237aea1c1f47fe59537c074 /sql/item.cc | |
parent | 40de15baa14a054861394fdd91a12f85b5010264 (diff) | |
download | mariadb-git-ab8ff15cd148a0a5855d2474db78c05ec28f20c7.tar.gz |
Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN
on index
'my_decimal' class has two members which can be used to access the
value. The member variable buf (inherited from parent class decimal_t)
is set to member variable buffer so that both are pointing to same value.
Item_copy_decimal::copy() uses memcpy to clone 'my_decimal'. The member
buffer is declared as an array and memcpy results in copying the values
of the array, but the inherited member buf, which should be pointing at
the begining of the array 'buffer' starts pointing to the begining of
buffer in original object (which is being cloned). Further updates on
'my_decimal' updates only the inherited member 'buf' but leaves
buffer unchanged.
Later when the new object (which now holds a inconsistent value) is cloned
again using proper cloning function 'my_decimal2decimal' the buf pointer
is fixed resulting in loss of the current value.
Using my_decimal2decimal instead of memcpy in Item_copy_decimal::copy()
fixed this problem.
mysql-test/r/subselect.result:
Updated result file after addding test case for bug#47904.
mysql-test/t/subselect.test:
Added test case for bug#47904.
sql/item.cc:
Memcopy shouldn't be used to clone my_decimal. Use my_decimal2decimal
instead.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index 809377e80b3..10da20beebe 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3515,7 +3515,7 @@ void Item_copy_decimal::copy() { my_decimal *nr= item->val_decimal(&cached_value); if (nr && nr != &cached_value) - memcpy (&cached_value, nr, sizeof (my_decimal)); + my_decimal2decimal (nr, &cached_value); null_value= item->null_value; } |