summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-03-03 17:38:59 +0300
committerunknown <konstantin@mysql.com>2005-03-03 17:38:59 +0300
commit2860a7723e8df63022c0f7a5aa3ab52996c798ed (patch)
treede4ae25a3579f97889c6570be94ff3d571920daf /sql/item_cmpfunc.h
parent66d2d13a8e3e70e54d92fc6686601b72f3bd2464 (diff)
downloadmariadb-git-2860a7723e8df63022c0f7a5aa3ab52996c798ed.tar.gz
Fixes for bug#8115 "Server Crash with prepared statement"
and bug#8849 "problem with insert statement with table alias's": make equality propagation work in stored procedures and prepared statements. Equality propagation can change AND/OR structure of ON expressions, so the fix is to provide each execution of PS/SP with it's own copy of AND/OR tree. We have been doing that already for WHERE clauses, now ON clauses are also copied. mysql-test/r/ps.result: Bug#8115: test results fixed. mysql-test/r/sp.result: Bug#8849: test results fixed. mysql-test/t/ps.test: A test case for Bug#8115 "Server Crash with prepared statement". mysql-test/t/sp.test: A test case for Bug#8849 "problem with insert statement with table alias's". sql/item_cmpfunc.cc: Comment a parse tree transformation. sql/item_cmpfunc.h: Comment how Item_equal works with PS/SP. sql/mysql_priv.h: Add declaration for init_stmt_after_parse. sql/sp_head.cc: Call init_stmt_after_parse in restore_lex(), which is used to grab TABLE_LIST and SELECT_LEX list of a parsed substatement of stored procedure. This is a necessary post-init step which must be done for any statement which can be executed many times. sql/sql_prepare.cc: Implement init_stmt_after_parse() which prepares AND/OR structure of all ON expressions and WHERE clauses of a statement for copying. sql/sql_select.cc: Implementation of equality propagation inspected with regard to prepared statements and stored procedures. We now restore AND/OR structure of every ON expression in addition to AND/OR structure of WHERE clauses when reexecuting a PS/SP. sql/table.h: Add declaration for TABLE::prep_on_expr.
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r--sql/item_cmpfunc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 212a3dd4501..5a87635a4dc 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1095,6 +1095,12 @@ public:
predicates that can not be used to access tables in the investigated
plan for those, obtained by substitution of some fields for equal fields,
that can be used.
+
+ Prepared Statements/Stored Procedures note: instances of class
+ Item_equal are created only at the time a PS/SP is executed and
+ are deleted in the end of execution. All changes made to these
+ objects need not be registered in the list of changes of the parse
+ tree and do not harm PS/SP re-execution.
*/
class Item_equal: public Item_bool_func