diff options
author | Alexander Nozdrin <alexander.nozdrin@oracle.com> | 2011-06-21 19:24:44 +0400 |
---|---|---|
committer | Alexander Nozdrin <alexander.nozdrin@oracle.com> | 2011-06-21 19:24:44 +0400 |
commit | 1c810152963f770fae011b29ae30fbafbc516b23 (patch) | |
tree | 47029d48aacb6bbb86e875a11cadcf4d934f2244 /sql/item_timefunc.cc | |
parent | bdb10545f1430e5df6bbc0f7d347cbc9596372ad (diff) | |
download | mariadb-git-1c810152963f770fae011b29ae30fbafbc516b23.tar.gz |
Patch for Bug 12652769 - 61470: CASE OPERATOR IN STORED ROUTINE RETAINS
OLD VALUE OF INPUT PARAMETER.
The user-visible problem was that CASE-control-flow function
(not CASE-statement) misbehaved in stored routines under some
circumstances. The problem resulted in a crash or wrong data
returned. The error happened when expressions in CASE-function
were not of the same character set.
A CASE-function should return values of the same character set
for all branches. Internally, that means a new Item-instance
for the CONVERT(... USING <some charset>)-function is added
to the item tree when needed. The problem was that such changes
were not properly recorded using THD::change_item_tree(),
thus dangling pointers remain in the item tree after
THD::rollback_item_tree_changes(), which lead to undefined
behavior (i.e. crash / wrong data) for subsequent executions of
the stored routine.
This bug was introduced by a patch for Bug 11753363
(44793 - CHARACTER SETS: CASE CLAUSE, UCS2 OR UTF32, FAILURE).
The fixed function is Item_func_case::fix_length_and_dec().
New CONVERT-items are added in agg_item_set_converter(),
which calls THD::change_item_tree().
The problem was that an intermediate array was passed
to agg_item_set_converter(). Thus, THD::change_item_tree() there
was called on intermediate objects.
Note: those intermediate objects are allocated on THD's
memory root, so it's Ok to put them into "changed item lists".
The fix is to track changes on the correct objects.
Diffstat (limited to 'sql/item_timefunc.cc')
0 files changed, 0 insertions, 0 deletions