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.
Showing
Please register or sign in to comment