summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-10139 Support for SEQUENCE objectsMonty2017-05-081-0/+1
| | | | | | | | | | - SETVAL(sequence_name, next_value, is_used, round) - ALTER SEQUENCE, including RESTART WITH Other things: - Added handler::extra() option HA_EXTRA_PREPARE_FOR_ALTER_TABLE to signal ha_sequence() that it should allow write_row statments. - ALTER ONLINE TABLE now works with SEQUENCE:s
* MDEV-12695 Add Column_definition::type_handler()Alexander Barkov2017-05-051-1/+1
|
* A cleanup for MDEV-12619 UNION creates excessive integer column types for ↵Alexander Barkov2017-05-041-1/+1
| | | | | | | integer literals Fixing result set metadata for Item_int to match type_handler(), i.e. MYSQL_TYPE_LONG for small numbers and MYSQL_TYPE_LONGLONG for big numbers.
* Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-32/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* MDEV-10139 Support for SEQUENCE objectsMonty2017-04-071-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Working features: CREATE OR REPLACE [TEMPORARY] SEQUENCE [IF NOT EXISTS] name [ INCREMENT [ BY | = ] increment ] [ MINVALUE [=] minvalue | NO MINVALUE ] [ MAXVALUE [=] maxvalue | NO MAXVALUE ] [ START [ WITH | = ] start ] [ CACHE [=] cache ] [ [ NO ] CYCLE ] ENGINE=xxx COMMENT=".." SELECT NEXT VALUE FOR sequence_name; SELECT NEXTVAL(sequence_name); SELECT PREVIOUS VALUE FOR sequence_name; SELECT LASTVAL(sequence_name); SHOW CREATE SEQUENCE sequence_name; SHOW CREATE TABLE sequence_name; CREATE TABLE sequence-structure ... SEQUENCE=1 ALTER TABLE sequence RENAME TO sequence2; RENAME TABLE sequence TO sequence2; DROP [TEMPORARY] SEQUENCE [IF EXISTS] sequence_names Missing features - SETVAL(value,sequence_name), to be used with replication. - Check replication, including checking that sequence tables are marked not transactional. - Check that a commit happens for NEXT VALUE that changes table data (may already work) - ALTER SEQUENCE. ANSI SQL version of setval. - Share identical sequence entries to not add things twice to table list. - testing insert/delete/update/truncate/load data - Run and fix Alibaba sequence tests (part of mysql-test/suite/sql_sequence) - Write documentation for NEXT VALUE / PREVIOUS_VALUE - NEXTVAL in DEFAULT - Ensure that NEXTVAL in DEFAULT uses database from base table - Two NEXTVAL for same row should give same answer. - Oracle syntax sequence_table.nextval, without any FOR or FROM. - Sequence tables are treated as 'not read constant tables' by SELECT; Would be better if we would have a separate list for sequence tables so that select doesn't know about them, except if refereed to with FROM. Other things done: - Improved output for safemalloc backtrack - frm_type_enum changed to Table_type - Removed lex->is_view and replaced with lex->table_type. This allows use to more easy check if item is view, sequence or table. - Added table flag HA_CAN_TABLES_WITHOUT_ROLLBACK, needed for handlers that want's to support sequences - Added handler calls: - engine_name(), to simplify getting engine name for partition and sequences - update_first_row(), to be able to do efficient sequence implementations. - Made binlog_log_row() global to be able to call it from ha_sequence.cc - Added handler variable: row_already_logged, to be able to flag that the changed row is already logging to replication log. - Added CF_DB_CHANGE and CF_SCHEMA_CHANGE flags to simplify deny_updates_if_read_only_option() - Added sp_add_cfetch() to avoid new conflicts in sql_yacc.yy - Moved code for add_table_options() out from sql_show.cc::show_create_table() - Added String::append_longlong() and used it in sql_show.cc to simplify code. - Added extra option to dd_frm_type() and ha_table_exists to indicate if the table is a sequence. Needed by DROP SQUENCE to not drop a table.
* MDEV-12441 Variables declared after cursors with parameters lose valuesAlexander Barkov2017-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parse context frames (sp_pcontext) can have holes in variable run-time offsets, the missing offsets reside on the children contexts in such cases. Example: CREATE PROCEDURE p1() AS x0 INT:=100; -- context 0, position 0, run-time 0 CURSOR cur( p0 INT, -- context 1, position 0, run-time 1 p1 INT -- context 1, position 1, run-time 2 ) IS SELECT p0, p1; x1 INT:=101; -- context 0, position 1, run-time 3 BEGIN ... END; Fixing a few methods to take this into account: - sp_pcontext::find_variable() - sp_pcontext::retrieve_field_definitions() - LEX::sp_variable_declarations_init() - LEX::sp_variable_declarations_finalize() - LEX::sp_variable_declarations_rowtype_finalize() - LEX::sp_variable_declarations_with_ref_finalize() Adding a convenience method: sp_pcontext::get_last_context_variable(uint offset_from_the_end); to access variables from the end, rather than from the beginning. This helps to loop through the context variable array (m_vars) on the fragment that does not have any holes. Additionally, renaming sp_pcontext::find_context_variable() to sp_pcontext::get_context_variable(). This method simply returns the variable by its index. So let's rename to avoid assumptions that some heavy lookup is going on inside.
* A cleanup for MDEV-10914 ROW data type for stored routine variablesAlexander Barkov2017-04-051-2/+2
| | | | Addressing Monty's review suggestions
* A cleanup patch for MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable ↵Alexander Barkov2017-04-051-3/+11
| | | | | | declarations Addressing Monty's review suggestions
* Uninitialized Column_definition::pack_flag for ROW-type SP variables and ↵Alexander Barkov2017-04-051-1/+2
| | | | | | | | | | | | | | | their fields Fixed that the Column_definition::pack_flag member corresponding to ROW-type SP variables and their fields was not properly initialized. This lead to sporadic test failures. Valgrind complained about jumps depending on uninitialized value in VALGRIND builds. This patch makes sure that sp_head::fill_spvar_definition() is always called for ROW variables and their fields. Additionally, fixed that a function with a scalar parameter erroneously acceptes ROWs with one fields. Now an error is returned.
* MDEV-12314 Implicit cursor FOR LOOP for cursors with parametersAlexander Barkov2017-04-051-3/+37
|
* MDEV-10598 Variable declarations can go after cursor declarationsAlexander Barkov2017-04-051-0/+17
| | | | Based on a contributed patch from Jerome Brauge.
* MDEV-10581 sql_mode=ORACLE: Explicit cursor FOR LOOPAlexander Barkov2017-04-051-0/+29
| | | | MDEV-12098 sql_mode=ORACLE: Implicit cursor FOR loop
* MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable declarationsAlexander Barkov2017-04-051-15/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing cursor%ROWTYPE variables, according to the task description. This patch includes a refactoring in how sp_instr_cpush and sp_instr_copen work. This is needed to implement MDEV-10598 later easier, to allow variable declarations go after cursor declarations (which is currently not allowed). Before this patch, sp_instr_cpush worked as a Query_arena associated with the cursor. sp_instr_copen::execute() switched to the sp_instr_cpush's Query_arena when executing the cursor SELECT statement. Now the Query_arena associated with the cursor is stored inside an instance of a new class sp_lex_cursor (a LEX descendand) that contains the cursor SELECT statement. This simplifies the implementation, because: - It's easier to follow the code when everything related to execution of the cursor SELECT statement is stored inside the same sp_lex_cursor object (rather than distributed between LEX and sp_instr_cpush). - It's easier to link an sp_instr_cursor_copy_struct to sp_lex_cursor rather than to sp_instr_cpush. - Also, it allows to perform sp_instr_cursor_copy_struct::exec_core() without having a pointer to sp_instr_cpush, using a pointer to sp_lex_cursor instead. This will be important for MDEV-10598, because sp_instr_cpush will happen *after* sp_instr_cursor_copy_struct. After MDEV-10598 is done, this declaration: DECLARE CURSOR cur IS SELECT * FROM t1; rec cur%ROWTYPE; BEGIN OPEN cur; FETCH cur INTO rec; CLOSE cur; END; will generate about this code: +-----+--------------------------+ | Pos | Instruction | +-----+--------------------------+ | 0 | cursor_copy_struct rec@0 | Points to sp_cursor_lex through m_lex_keeper | 1 | set rec@0 NULL | | 2 | cpush cur@0 | Points to sp_cursor_lex through m_lex_keeper | 3 | copen cur@0 | Points to sp_cursor_lex through m_cursor | 4 | cfetch cur@0 rec@0 | | 5 | cclose cur@0 | | 6 | cpop 1 | +-----+--------------------------+ Notice, "cursor_copy_struct" and "set" will go before "cpush". Instructions at positions 0, 2, 3 point to the same sp_cursor_lex instance.
* MDEV-12133 sql_mode=ORACLE: table%ROWTYPE in variable declarationsAlexander Barkov2017-04-051-3/+84
|
* MDEV-12209 sql_mode=ORACLE: Syntax error in a OPEN cursor with parameters ↵Alexander Barkov2017-04-051-7/+10
| | | | | | | | | | | | makes the server crash The bug was introduced in the patch for "MDEV-10597 Cursors with parameters". The LEX created in assignment_source_expr was not put into thd->lex->sphead->m_lex (the stack of LEX'es), so syntax error in "expr" caused a wrong memory cleanup in sp_head::~sp_head(). The fix changes the code to use sp_head::push_lex() followed by sp_head::restore_lex(), like it happens in all other similar cases.
* MDEV-10697 GOTO statementhalfspawn2017-04-051-2/+133
|
* MDEV-10914 ROW data type for stored routine variablesAlexander Barkov2017-04-051-23/+134
|
* MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarationsAlexander Barkov2017-04-051-4/+40
|
* MDEV-10597 Cursors with parametersAlexander Barkov2017-04-051-34/+65
|
* MDEV-10578 sql_mode=ORACLE: SP control functions SQLCODE, SQLERRMAlexander Barkov2017-04-051-2/+15
|
* MDEV-10411 Providing compatibility for basic PL/SQL constructsAlexander Barkov2017-04-051-2/+2
| | | | | | | | | Moving the code from *.yy to methods: LEX::sp_change_context() LEX::sp_leave_statement() LEX::sp_iterate_statement() to reuse the same code between LEAVE and ITERATE statements. EXIT statement will also reuse the same code.
* Optimization for MDEV-10411 Providing compatibility for basic PL/SQL constructsAlexander Barkov2017-04-051-0/+28
| | | | | | | | | | | | | | | | | | When processing an SP body: CREATE PROCEDURE p1 (parameters) AS [ declarations ] BEGIN statements [ EXCEPTION exceptions ] END; the parser generates two "jump" instructions: - from the end of "declarations" to the beginning of EXCEPTION - from the end of EXCEPTION to "statements" These jumps are useless if EXCEPTION does not exist. This patch makes sure that these two "jump" instructions are generated only if EXCEPTION really exists.
* MDEV-10411 Providing compatibility for basic PL/SQL constructsAlexander Barkov2017-04-051-0/+27
| | | | | | | | | | | | | | | - Part 9: EXCEPTION handlers The top-most stored routine blocks now support EXCEPTION clause in its correct place: AS [ declarations ] BEGIN statements [ EXCEPTION exceptions ] END Inner block will be done in a separate commit. - Part 14: IN OUT instead of INOUT (in SP parameter declarations)
* MDEV-12415 Remove sp_name::m_qnameAlexander Barkov2017-03-311-42/+10
|
* Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-02-271-13/+9
|\
| * Merge branch '10.1' into 10.2Sergei Golubchik2017-02-101-13/+9
| |\
| | * Merge branch '10.0' into 10.1Vicențiu Ciorbaru2017-01-161-13/+9
| | |\
| | | * Merge remote-tracking branch 'origin/5.5' into 10.0vicentiu2017-01-061-13/+9
| | | |\
| | | | * reduce code duplication a littlemariadb-5.5.54Sergei Golubchik2016-12-221-5/+1
| | | | |
| | | | * MDEV-11552 Queries executed by event scheduler are written to slow log ↵Sergei Golubchik2016-12-171-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | incorrectly or not written at all because thd->update_server_status() is used to measure the query time for the slow log (not only to set protocol level flags), it needs to be called also when the server isn't going to send anything to the client.
* | | | | MDEV-11913 Split sp_get_item_value() into methods in Type_handlerAlexander Barkov2017-02-011-63/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch also fixes: MDEV-11815 SP variables of temporal data types do not replicate correctly Temporal values are now printed in temporal literal format, with the SQL-standard data type prefix: TIME'10:20:30', DATE'2001-01-01', TIMESTAMP'2001-01-01 10:20:30' Previously temporal values were printed using the text string notation, e.g. _latin1'10:20:30' COLLATE latin1_swedish_ci, hence the bug.
* | | | | MDEV-11245 Move prepare_create_field and sp_prepare_create_field() as ↵Alexander Barkov2016-12-161-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | methods to Column_definition Some upcoming tasks, e.g.: - MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations - MDEV-10914 ROW data type for stored routine variables will need to reuse the code implemented in prepare_create_field(), sp_prepare_create_field(), prepare_blob_field(). Before reusing this code, it's a good idea to move these global functions as methods to Column_definition. This patch: - actually moves prepare_create_field(), sp_prepare_create_field(), prepare_blob_field() as methods to Column_definition - makes sp_prepare_create_field() call prepare_create_field() at the end, to avoid duplicate code in MDEV-10577 and MDEV-10914. - changes the return data type for prepare_create_field() from int to bool, to make it consistent with all other functions returning "ok" or "error". - moves the implementation sp_head::fill_field_definition() from sp_head.cc to sp_head.h, as it now uses globally visible Column_definition methods, and is very simple, so inlining is now possible. - removes the unused "LEX*" argument from sp_head::fill_field_definition()
* | | | | MDEV-11146 SP variables of the SET data type erroneously allow values with commaAlexander Barkov2016-12-161-57/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a duplicate code to create TYPELIB from List<String>: - In typelib() and mysql_prepare_create_table(), which was used to initialize table fields. - create_typelib() and sp_prepare_create_field(), which was used to initialize SP variables. create_typelib() was incomplete and didn't check for wrong SET values. Fix: - Moving the code from create_typelib() and mysql_prepare_create_field() to news methods Column_definition::create_interval_from_interval_list() and Column_definition::prepare_interval_field(). - Moving the code from calculate_interval_lengths() in sql_table.cc to a new method Column_definition::calculate_interval_lengths(), as it's now needed only in Column_definition::create_interval_from_interval_list() - Reusing the new method Column_definition::prepare_interval_field() in both mysql_prepare_create_table() and sp_prepare_create_field(), instead of the old duplicate code pieces - Removing global functions typelib() and create_typelib() This patch also fixes: MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters The problem was that ErrCongString() was called with a wrong "charset" parameter.
* | | | extend prelocking to FK-accessed tablesSergei Golubchik2016-12-121-1/+1
| | | |
* | | | cleanup: sp_head::add_used_tables_to_table_list()Sergei Golubchik2016-12-121-27/+6
| | | | | | | | | | | | | | | | | | | | Use TABLE::init_one_table(), don't duplicate it. Put additional initializations into TABLE::init_one_table_for_prelocking()
* | | | MDEV-10585 EXECUTE IMMEDIATE statementAlexander Barkov2016-10-081-0/+1
| | | |
* | | | Use sql_mode_t for sql_mode.Monty2016-10-051-1/+1
| | | | | | | | | | | | | | | | This fixed several cases where we where using just ulong for sql_mode
* | | | MDEV-6112 multiple triggers per tableMonty2016-10-051-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to MysQL Worklog 3253, but with a different implementation. The disk format and SQL syntax is identical with MySQL 5.7. Fetures supported: - "Any" ammount of any trigger - Supports FOLLOWS and PRECEDES to be able to put triggers in a certain execution order. Implementation details: - Class Trigger added to hold information about a trigger. Before this trigger information was stored in a set of lists in Table_triggers_list and in Table_triggers_list::bodies - Each Trigger has a next field that poinst to the next Trigger with the same action and time. - When accessing a trigger, we now always access all linked triggers - The list are now only used to load and save trigger files. - MySQL trigger test case (trigger_wl3253) added and we execute these identically. - Even more gracefully handling of wrong trigger files than before. This is useful if a trigger file uses functions or syntax not provided by the server. - Each trigger now has a "Created" field that shows when the trigger was created, with 2 decimals. Other comments: - Many of the changes in test files was done because of the new "Created" field in the trigger file. This shows up in SHOW ... TRIGGER and when using information_schema.trigger. - Don't check if all memory is released if on uses --gdb; This is needed to be able to get a list from safemalloc of not freed memory while debugging. - Added option to trim_whitespace() to know how many prefix characters was skipped. - Changed a few ulonglong sql_mode to sql_mode_t, to find some wrong usage of sql_mode.
* | | | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-2/+4
| | | | | | | | | | | | | | | | | | | | Postreview fixes. New MySQL tests fixes.
* | | | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-0/+5
| | | | | | | | | | | | | | | | Transaction tracker
* | | | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-0/+10
| | | | | | | | | | | | | | | | initial commit to test
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-06-301-4/+6
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2016-06-281-4/+6
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into bb-10.0Sergei Golubchik2016-06-211-4/+6
| | |\ \ | | | |/
| | | * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2016-06-141-4/+6
| | | |\
| | | | * BUG#22286421: NULL POINTER DEREFERENCEKarthik Kamath2016-04-191-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ANALYSIS: ========= A LEX_STRING structure pointer is processed during the validation of a stored program name. During this processing, there is a possibility of null pointer dereference. FIX: ==== check_routine_name() is invoked by the parser by supplying a non-empty string as the SP name. To avoid any potential calls to check_routine_name() with NULL value, a debug assert has been added to catch such cases.
| | | | * Fix for bug#14188793 - "DEADLOCK CAUSED BY ALTER TABLE DOEN'T CLEARDmitry Lenev2013-08-201-9/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | STATUS OF ROLLBACKED TRANSACTION" and bug #17054007 - "TRANSACTION IS NOT FULLY ROLLED BACK IN CASE OF INNODB DEADLOCK". The problem in the first bug report was that although deadlock involving metadata locks was reported using the same error code and message as InnoDB deadlock it didn't rollback transaction like the latter. This caused confusion to users as in some cases after ER_LOCK_DEADLOCK transaction could have been restarted immediately and in some cases rollback was required. The problem in the second bug report was that although InnoDB deadlock caused transaction rollback in all storage engines it didn't cause release of metadata locks. So concurrent DDL on the tables used in transaction was blocked until implicit or explicit COMMIT or ROLLBACK was issued in the connection which got InnoDB deadlock. The former issue has stemmed from the fact that when support for detection and reporting metadata locks deadlocks was added we erroneously assumed that InnoDB doesn't rollback transaction on deadlock but only last statement (while this is what happens on InnoDB lock timeout actually) and so didn't implement rollback of transactions on MDL deadlocks. The latter issue was caused by the fact that rollback of transaction due to deadlock is carried out by setting THD::transaction_rollback_request flag at the point where deadlock is detected and performing rollback inside of trans_rollback_stmt() call when this flag is set. And trans_rollback_stmt() is not aware of MDL locks, so no MDL locks are released. This patch solves these two problems in the following way: - In case when MDL deadlock is detect transaction rollback is requested by setting THD::transaction_rollback_request flag. - Code performing rollback of transaction if THD::transaction_rollback_request is moved out from trans_rollback_stmt(). Now we handle rollback request on the same level as we call trans_rollback_stmt() and release statement/ transaction MDL locks.
| | | | * Bug#16056537: MYSQLD CRASHES IN ITEM_FUNC_GET_USER_VAR::FIX_LENGTH_AND_DEC()Alexander Nozdrin2013-02-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The technical problem was that THD::user_var_events_alloc was reset to NULL from a valid value when a stored program is executed during the PREPARE statement. The user visible problem was that the server crashed if user issued a PREPARE statement using some combination of stored functions and user variables. The fix is to restore THD::user_var_events_alloc to the original value. This is a minimal fix for 5.5. More proper patch has been already implemented for 5.6+. It avoids evaluation of stored functions for the PREPARE phase. From the user point of view, this bug is a regression, introduced by the patch for WL2649 (Number-to-string conversions), revid: bar@mysql.com-20100211041725-ijbox021olab82nv However, the code resetting THD::user_var_events_alloc exists even in 5.1. The WL just changed the way arguments are converted to strings and the bug became visible.
| | | | * Merged fix for bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS"Dmitry Lenev2012-12-051-22/+28
| | | | |\ | | | | | | | | | | | | into 5.5 tree.
| | | | | * Bug #15954896 "SP, MULTI-TABLE DELETE AND LONG ALIAS".Dmitry Lenev2012-12-051-22/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using too long table aliases in stored routines might have caused server crashes. Code in sp_head::merge_table_list() which is responsible for collecting information about tables used in stored routine was not aware of the fact that table alias might have arbitrary length. I.e. it assumed that table alias can't be longer than NAME_LEN bytes and allocated buffer for a key identifying table accordingly. This patch fixes the issue by ensuring that we use dynamically allocated buffer for table key when table alias is too long. By default stack based buffer is used in which NAME_LEN bytes are reserved for table alias.