diff options
author | konstantin@mysql.com <> | 2004-08-21 02:02:46 +0400 |
---|---|---|
committer | konstantin@mysql.com <> | 2004-08-21 02:02:46 +0400 |
commit | 568c6e8526bded952225a9f4d2b262582091ae78 (patch) | |
tree | 687b98d21d388c1958d7cabd22c8c450eecca73e /mysql-test/r | |
parent | b9dbef8e239b0ad70d0e4da376736611164bf96d (diff) | |
download | mariadb-git-568c6e8526bded952225a9f4d2b262582091ae78.tar.gz |
Fix for bug#4912 "mysqld crashs in case a statement is executed
a second time". The bug was caused by incompatibility of
negations elimination algorithm and PS: during first statement
execute a subtree with negation was replaced with equivalent
subtree without NOTs.
The problem was that although this transformation was permanent,
items of the new subtree were created in execute-local memory.
The patch adds means to check if it is the first execute of a
prepared statement, and if this is the case, to allocate items
in memory of the prepared statement.
The implementation:
- backports Item_arena from 5.0
- adds Item_arena::is_stmt_prepare(),
Item_arena::is_first_stmt_execute().
- deletes THD::allocate_temporary_pool_for_ps_preparing(),
THD::free_temporary_pool_for_ps_preparing(); they
were redundant.
and adds a few invariants:
- thd->free_list never contains junk (= freed items)
- thd->current_arena is never null. If there is no
prepared statement, it points at the thd.
The rest of the patch contains mainly mechanical changes and
cleanups.
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/ps.result | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 27f4ce7f815..0523143f91d 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -219,3 +219,10 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I t1 MyISAM 9 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL deallocate prepare stmt1 ; drop table t1; +create table t1(a varchar(2), b varchar(3)); +prepare stmt1 from "select a, b from t1 where (not (a='aa' and b < 'zzz'))"; +execute stmt1; +a b +execute stmt1; +a b +deallocate prepare stmt1; |