summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-error.test
Commit message (Collapse)AuthorAgeFilesLines
* Create 'main' test directory and move 't' and 'r' thereMichael Widenius2018-03-291-3851/+0
|
* MDEV-7773: Aggregate stored functionsVarun Gupta2017-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements aggregate stored functions. The basic idea behind the feature is: * Implement a special instruction FETCH GROUP NEXT ROW that will pause the execution of the stored function. When the instruction is reached, execution of the initial query resumes "as if" the function returned. This gives the server the opportunity to advance to the next row in the result set. * Stored aggregates behave like regular aggregate functions. The implementation of thus resides in the class Item_sum_sp. Because it is an aggregate function, for each new row in the group, the Item_sum_sp::add() method will be called. This is when execution resumes and the function does another iteration to "add" one extra element to the final result. * When the end of group is reached, val_xxx() method will be called for the item. This case is handled by another execute step for the stored function, only with a special flag to force a call to the return handler. See Item_sum_sp::execute() for details. To allow this pause and resume semantic, we must preserve the function context across executions. This is stored in Item_sp::sp_query_arena only for aggregate stored functions, but has no impact for regular functions. We also enforce aggregate functions to include the "FETCH GROUP NEXT ROW" instruction. Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
* MDEV-7635: Update tests to adapt to the new default sql_modeNirbhay Choubey2017-02-101-9/+13
|
* MDEV-5535: Cannot reopen temporary tableNirbhay Choubey2016-06-101-3/+3
| | | | | | | | | | | | Temporary table being created by outer statement should not be visible to inner statement. And if inner statement creates a table with same name. The whole statement should fail with ER_TABLE_EXISTS_ERROR. Implemented by temporarily de-linking the TABLE_SHARE being created by outer statement so that it remains hidden to the inner statement.
* MDEV-3944: Allow derived tables in VIEWSOleksandr Byelkin2016-05-281-2/+2
|
* MDEV-10102 Disallow CREATE VIEW .. PROCEDURE ANALYSE() syntacticallyAlexander Barkov2016-05-231-4/+4
|
* MDEV-9166 Wrong error message and shift/reduce conflicts in the RETURNS clauseAlexander Barkov2015-11-231-1/+1
|
* MDEV-8466 CAST works differently for DECIMAL/INT vs DOUBLE for empty stringsAlexander Barkov2015-09-171-2/+2
| | | | MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
* MDEV-7283 UDF: CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTSAlexander Barkov2014-12-151-2/+1
| | | | MDEV-7282 SP: CREATE OR REPLACE, CREATE IF NOT EXISTS
* parser cleanup: don't store field properties in LEX, use Create_field directlySergei Golubchik2014-12-041-6/+1
| | | | | | | | | | | length/dec/charset are still in LEX, because they're also used for CAST and dynamic columns. also 1. fix "MDEV-7041 COLLATION(CAST('a' AS CHAR BINARY)) returns a wrong result" 2. allow BINARY modifier in stored function RETURN clause 3. allow "COLLATION without CHARSET" in SP/SF (parameters, RETURN, DECLARE) 4. print correct variable name in error messages for stored routine parameters
* merge bugfuxes for sp-error.testSergei Golubchik2013-07-121-0/+970
|
* merge 5.1-security->5.5-securityGeorgi Kodinov2011-06-161-0/+22
|\
| * Fixed bug#11840395 (formerly known as bug#60347: THE STRING "VERSIONDATA"Dmitry Shulga2011-06-091-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SEEMS TO BE 'LEAKING' INTO THE SCHEMA NAME SPACE) and bug#12428824 (Parser stack overflow and crash in sp_add_used_routine with obscure query). The first problem was that attempts to call a stored function by its fully qualified name ended up with unwarranted error "ERROR 1305 (42000): FUNCTION someMixedCaseDb.my_function_name does not exist" if this function belonged to a schema that had uppercase letters in its name AND --lower_case_table_names was equal to either 1 or 2. The second problem was that 5.5 version of MySQL server might have crashed when a user tried to call stored function with too long name or too long database name (i.e if a function and database name combined occupied more than 2*3*64 bytes in utf8). This issue didn't affect versions of server < 5.5. The first problem was caused by the fact that in cases when a stored function was called by its fully qualified name we didn't lowercase name of its schema before performing look up of the function in mysql.proc table even although lower_case_table_names mode was on. As result we were unable to find this function since during its creation we store lowercased version of schema name in the system table in this mode and field for schema name uses binary collation. Calls to stored functions were unaffected by this problem since for them schema name is converted to lowercase as necessary. The reason for the second bug was that MySQL Server didn't check length of function name and database name before proceeding with execution of stored function. As a consequence too long database name or function name caused buffer overruns in places where the code assumes that their length is within fixed limits, like mdl_key_init() in 5.5. Again this issue didn't affect calls to stored procedures as for them length of schema name and procedure name are properly checked. This patch fixes both these bugs by adding calls to check_db_name() and check_routine_name() to grammar rule which corresponds to a call to a stored function. These functions ensure that length of database name and function name for routine called is within standard limit. Moreover call to check_db_name() handles conversion of database name to lowercase if --lower_case_table_names mode is on. Note that even although the second issue seems to be only reproducible in 5.5 we still add code fixing it to 5.1 to be on the safe side (and make code a bit more robust against possible future changes). mysql-test/r/sp-error.result: Added testcase results for bug#12428824. mysql-test/r/sp.result: Added testcase result for bug#11840395. mysql-test/t/sp-error.test: Added testcase for bug#12428824. mysql-test/t/sp.test: Added testcase for bug#11840395. sql/sql_yacc.yy: Modified 'function_call_generic' rule to call check_db_name() and check_routine_name() in order to ensure that lengths of database name and function name are within limits. check_db_name() is also responsible for normalizing function's database name for lookup in cases when lowercase_table_names mode is on.
* | Patch for Bug#55850 (Trigger warnings not cleared).Alexander Nozdrin2010-10-261-34/+80
| | | | | | | | | | | | | | | | The problem was that the warnings risen by a trigger were not cleared upon successful completion. The warnings should be cleared if the trigger completes successfully. The fix is to skip merging warnings into caller's Warning Info for triggers.
* | Auto-merge from mysql-trunk-bugfixing.Alexander Nozdrin2010-07-301-0/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ****** This patch fixes the following bugs: - Bug#5889: Exit handler for a warning doesn't hide the warning in trigger - Bug#9857: Stored procedures: handler for sqlwarning ignored - Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP - Bug#36185: Incorrect precedence for warning and exception handlers The problem was in the way warnings/errors during stored routine execution were handled. Prior to this patch the logic was as follows: - when a warning/an error happens: if we're executing a stored routine, and there is a handler for that warning/error, remember the handler, ignore the warning/error and continue execution. - after a stored routine instruction is executed: check for a remembered handler and activate one (if any). This logic caused several problems: - if one instruction generates several warnings (errors) it's impossible to choose the right handler -- a handler for the first generated condition was chosen and remembered for activation. - mess with handling conditions in scopes different from the current one. - not putting generated warnings/errors into Warning Info (Diagnostic Area) is against The Standard. The patch changes the logic as follows: - Diagnostic Area is cleared on the beginning of each statement that either is able to generate warnings, or is able to work with tables. - at the end of a stored routine instruction, Diagnostic Area is left intact. - Diagnostic Area is checked after each stored routine instruction. If an instruction generates several condition, it's now possible to take a look at all of them and determine an appropriate handler. mysql-test/r/signal.result: Update result file: 1. handled conditions are not cleared any more; 2. reflect changes in signal.test mysql-test/r/signal_demo3.result: Update result file: handled conditions are not cleared any more. Due to playing with max_error_count, resulting warning lists have changed. mysql-test/r/sp-big.result: Update result file: handled conditions are not cleared any more. mysql-test/r/sp-bugs.result: Update result file: handled conditions are not cleared any more. mysql-test/r/sp-code.result: Update result file: 1. handled conditions are not cleared any more. 2. add result for a new test case in sp-code.test. mysql-test/r/sp-error.result: Update result file: 1. handled conditions are not cleared any more. 2. add result for a new test case in sp-error.test. mysql-test/r/sp.result: Update result file: handled conditions are not cleared any more. mysql-test/r/sp_trans.result: Update result file: handled conditions are not cleared any more. mysql-test/r/strict.result: Update result file: handled conditions are not cleared any more. mysql-test/r/view.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/funcs_1/r/innodb_storedproc_02.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/funcs_1/r/memory_storedproc_02.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/funcs_1/r/myisam_storedproc_02.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/funcs_1/r/storedproc.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/rpl/r/rpl_row_sp005.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result: Update result file: handled conditions are not cleared any more. mysql-test/suite/rpl/r/rpl_row_trig003.result: Update result file: handled conditions are not cleared any more. mysql-test/t/signal.test: Make a test case more readable in the result file. mysql-test/t/sp-code.test: Add a test case for Bug#23032 checking that No Data takes precedence on Warning. mysql-test/t/sp-error.test: Adding test cases for: - Bug#23032 - Bug#36185 - Bug#5889 - Bug#9857 mysql-test/t/sp.test: Fixing test case to reflect behavioral changes made by the patch. sql/sp_head.cc: Reset the per-statement warning count before executing a stored procedure instruction. Move to a separate function code which checks the completion status of the executed statement and searches for a handler. Remove redundant code now that search for a handler is done after execution, errors are always pushed. sql/sp_pcontext.h: Remove unused code. sql/sp_rcontext.cc: - Polish sp_rcontext::find_handler(): use sp_rcontext::m_hfound instead of an extra local variable; - Remove sp_rcontext::handle_condition(); - Introduce sp_rcontext::activate_handler(), which prepares previously found handler for execution. - Move sp_rcontext::enter_handler() code into activate_handler(), because enter_handler() is used only from there; - Cleanups; - Introduce DBUG_EXECUTE_IF() for a test case in sp-code.test sql/sp_rcontext.h: - Remove unused code - Cleanups sql/sql_class.cc: Merge THD::raise_condition_no_handler() into THD::raise_condition(). After the patch raise_condition_no_handler() was called in raise_condition() only. sql/sql_class.h: Remove raise_condition_no_handler(). sql/sql_error.cc: Remove Warning_info::reserve_space() -- handled conditions are not cleared any more, so there is no need for RESIGNAL to re-push them. sql/sql_error.h: Remove Warning_info::reserve_space(). sql/sql_signal.cc: Handled conditions are not cleared any more, so there is no need for RESIGNAL to re-push them.
* | Apply and review:Konstantin Osipov2009-12-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3655 Jon Olav Hauglid 2009-10-19 Bug #30977 Concurrent statement using stored function and DROP FUNCTION breaks SBR Bug #48246 assert in close_thread_table Implement a fix for: Bug #41804 purge stored procedure cache causes mysterious hang for many minutes Bug #49972 Crash in prepared statements The problem was that concurrent execution of DML statements that use stored functions and DDL statements that drop/modify the same function might result in incorrect binary log in statement (and mixed) mode and therefore break replication. This patch fixes the problem by introducing metadata locking for stored procedures and functions. This is similar to what is done in Bug#25144 for views. Procedures and functions now are locked using metadata locks until the transaction is either committed or rolled back. This prevents other statements from modifying the procedure/function while it is being executed. This provides commit ordering - guaranteeing serializability across multiple transactions and thus fixes the reported binlog problem. Note that we do not take locks for top-level CALLs. This means that procedures called directly are not protected from changes by simultaneous DDL operations so they are executed at the state they had at the time of the CALL. By not taking locks for top-level CALLs, we still allow transactions to be started inside procedures. This patch also changes stored procedure cache invalidation. Upon a change of cache version, we no longer invalidate the entire cache, but only those routines which we use, only when a statement is executed that uses them. This patch also changes the logic of prepared statement validation. A stored procedure used by a prepared statement is now validated only once a metadata lock has been acquired. A version mismatch causes a flush of the obsolete routine from the cache and statement reprepare. Incompatible changes: 1) ER_LOCK_DEADLOCK is reported for a transaction trying to access a procedure/function that is locked by a DDL operation in another connection. 2) Procedure/function DDL operations are now prohibited in LOCK TABLES mode as exclusive locks must be taken all at once and LOCK TABLES provides no way to specifiy procedures/functions to be locked. Test cases have been added to sp-lock.test and rpl_sp.test. Work on this bug has very much been a team effort and this patch includes and is based on contributions from Davi Arnaut, Dmitry Lenev, Magne Mæhre and Konstantin Osipov. mysql-test/r/ps_ddl.result: Update results (Bug#30977). mysql-test/r/ps_ddl1.result: Update results (Bug#30977). mysql-test/r/sp-error.result: Update results (Bug#30977). mysql-test/r/sp-lock.result: Update results (Bug#30977). mysql-test/suite/rpl/r/rpl_sp.result: Update results (Bug#30977). mysql-test/suite/rpl/t/rpl_sp.test: Add a test case for Bug#30977. mysql-test/t/ps_ddl.test: Update comments. We no longer re-prepare a prepared statement when a stored procedure used in top-level CALL is changed. mysql-test/t/ps_ddl1.test: Modifying stored procedure p1 no longer invalidates prepared statement "call p1" -- we can re-use the prepared statement without invalidation. mysql-test/t/sp-error.test: Use a constant for an error value. mysql-test/t/sp-lock.test: Add test coverage for Bug#30977. sql/lock.cc: Implement lock_routine_name() - a way to acquire an exclusive metadata lock (ex- name-lock) on stored procedure/function. sql/sp.cc: Change semantics of sp_cache_routine() -- now it has an option to make sure that the routine that is cached is up to date (has the latest sp cache version). Add sp_cache_invalidate() to sp_drop_routine(), where it was missing (a bug!). Acquire metadata locks for SP DDL (ALTER/CREATE/DROP). This is the core of the fix for Bug#30977. Since caching and cache invalidation scheme was changed, make sure we don't invalidate the SP cache in the middle of a stored routine execution. At the same time, make sure we don't access stale data due to lack of invalidation. For that, change ALTER FUNCTION/PROCEDURE to not use the cache, and SHOW PROCEDURE CODE/SHOW CREATE PROCEDURE/FUNCTION to always read an up to date version of the routine from the cache. sql/sp.h: Add a helper wrapper around sp_cache_routine(). sql/sp_cache.cc: Implement new sp_cache_version() and sp_cache_flush_obsolete(). Now we flush stale routines individually, rather than all at once. sql/sp_cache.h: Update signatures of sp_cache_version() and sp_cache_flush_obsolete(). sql/sp_head.cc: Add a default initialization of sp_head::m_sp_cache_version. Remove a redundant sp_head::create(). sql/sp_head.h: Add m_sp_cache_version to sp_head class - we now keep track of every routine in the stored procedure cache, rather than of the entire cache. sql/sql_base.cc: Implement prelocking for stored routines. Validate stored routines after they were locked. Flush obsolete routines upon next access, one by one, not all at once (Bug#41804). Style fixes. sql/sql_class.h: Rename a Open_table_context method. sql/sql_parse.cc: Make sure stored procedures DDL commits the active transaction (issues an implicit commit before and after). Remove sp_head::create(), a pure redundancy. Move the semantical check during alter routine inside sp_update_routine() code in order to: - avoid using SP cache during update, it may be obsolete. - speed up and simplify the update procedure. Remove sp_cache_flush_obsolete() calls, we no longer flush the entire cache, ever, stale routines are flushed before next use, one at a time. sql/sql_prepare.cc: Move routine metadata validation to open_and_process_routine(). Fix Bug#49972 (don't swap flags at reprepare). Reset Sroutine_hash_entries in reinit_stmt_before_use(). Remove SP cache invalidation, it's now done by open_tables(). sql/sql_show.cc: Fix a warning: remove an unused label. sql/sql_table.cc: Reset mdl_request.ticket for tickets acquired for routines inlined through a view, in CHECK TABLE statement, to satisfy an MDL assert. sql/sql_update.cc: Move the cleanup of "translation items" to close_tables_for_reopen(), since it's needed in all cases when we back off, not just the back-off in multi-update. This fixes a bug when the server would crash on attempt to back off when opening tables for a statement that uses information_schema tables.
* | Bug#46374 crash, INSERT INTO t1 uses function, function modifies t1Magne Mahre2009-12-101-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | An error occuring in the execution of a stored procedure, called from do_select is masked, since the error condition is not propagated back to the caller (join->conds->val_int() returns a result value, and not an error code) An explicit check was added to see if the thd error code has been set, and if so, the loop status is set to the error state. Backport from 6.0-codebase (revid: 2617.68.31)
* | Manual resolving for the following filesAndrei Elkin2009-12-011-18/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Text conflict in mysql-test/collections/default.experimental Text conflict in mysql-test/r/show_check.result Text conflict in mysql-test/r/sp-code.result Text conflict in mysql-test/suite/binlog/r/binlog_tmp_table.result Text conflict in mysql-test/suite/rpl/t/disabled.def Text conflict in mysql-test/t/show_check.test Text conflict in mysys/my_delete.c Text conflict in sql/item.h Text conflict in sql/item_cmpfunc.h Text conflict in sql/log.cc Text conflict in sql/mysqld.cc Text conflict in sql/repl_failsafe.cc Text conflict in sql/slave.cc Text conflict in sql/sql_parse.cc Text conflict in sql/sql_table.cc Text conflict in sql/sql_yacc.yy Text conflict in storage/myisam/ha_myisam.cc Corrected results for stm_auto_increment_bug33029.reject 2009-12-01 20:01:49.000000000 +0300 <andrei> @@ -42,9 +42,6 @@ <andrei> RETURN i; <andrei> END// <andrei> CALL p1(); <andrei> -Warnings: <andrei> -Note 1592 Statement may not be safe to log in statement format. <andrei> -Note 1592 Statement may not be safe to log in statement format. There should be indeed no Note present because there is in fact autoincrement top-level query in sp() that triggers inserting in yet another auto-inc table. (todo: alert DaoGang to improve the test).
| * \ merging from 5.1 to rep+2 starting at gca(5.1, next-mr) == ↵Andrei Elkin2009-11-301-0/+24
| |\ \ | | |/ | | | | | | build@mysql.com-20091104182209-iui387z35159aoyw
| * | BUG#48048: Deprecated constructs need removal in BetonyLuis Soares2009-11-041-18/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: Backport of: bzr log -r revid:sp1r-serg@sergbook.mysql.com-20070505200319-38337 ------------------------------------------------------------ revno: 2469.263.4 committer: serg@sergbook.mysql.com timestamp: Sat 2007-05-05 13:03:19 -0700 message: Removing deprecated features: --master-XXX command-line options log_bin_trust_routine_creators table_type BACKUP TABLE ... RESTORE TABLE ... SHOW PLUGIN LOAD TABLE ... FROM MASTER LOAD DATA FROM MASTER SHOW INNODB STATUS SHOW MUTEX STATUS SHOW TABLE TYPES ... TIMESTAMP(N) ... TYPE=engine RESET SLAVE don't reset connection parameters anymore LOAD DATA: check opt_secure_file_priv before access(filename) improved WARN_DEPRECATED macro
* | | Backport the test caes for Bug#36510 from 6.0-codebase.Konstantin Osipov2009-11-211-0/+37
| | | | | | | | | | | | | | | | | | mysql-test/t/sp-error.test: Backport test of Bug#36510 (the bug itself is fixed by other backports, inc. SINGAL code).
* | | Manual merge of mysql-next-mr-runtime upstream.Davi Arnaut2009-11-191-0/+21
|\ \ \ | |_|/ |/| |
| * | Post-merge fixes for backports.Davi Arnaut2009-11-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/sp-error.result: Update test case result. mysql-test/t/dirty_close.test: Dirty close does not work under embedded. mysql-test/t/sp-error.test: Use the specific error number so it won't catch other non-fatal errors.
| * | Backport of Bug#15192 to mysql-next-mrDavi Arnaut2009-11-101-0/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------ revno: 2597.4.17 revision-id: sp1r-davi@mysql.com/endora.local-20080328174753-24337 parent: sp1r-anozdrin/alik@quad.opbmk-20080328140038-16479 committer: davi@mysql.com/endora.local timestamp: Fri 2008-03-28 14:47:53 -0300 message: Bug#15192 "fatal errors" are caught by handlers in stored procedures The problem is that fatal errors (e.g.: out of memory) were being caught by stored procedure exception handlers which could cause the execution to not be stopped due to a continue handler. The solution is to not call any exception handler if the error is fatal and send the fatal error to the client. mysql-test/r/sp-error.result: Add test case result for Bug#15192 mysql-test/t/sp-error.test: Add test case for Bug#15192 mysys/my_alloc.c: Pass flag to signal fatal error in memory root allocations. sql/event_data_objects.cc: Use init_sql_alloc to initialize memory roots, which uses the sql error handler to push errors. sql/ha_partition.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/item_func.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/item_subselect.cc: Remove redundant fatal error, memory root already pushes error. sql/opt_sum.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/sp_head.cc: Allocator already sets fatal error. sql/sql_class.h: A error must exist for it to be fatal. Pass flag to signal fatal error instead of calling fatal_error. sql/sql_insert.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/sql_list.h: Pass flag to signal fatal error instead of calling fatal_error. sql/sql_parse.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/sql_partition.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/sql_select.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/sql_servers.cc: Use init_sql_alloc to initialize memory roots, which uses the sql error handler to push errors. sql/sql_show.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/sql_trigger.cc: Use init_sql_alloc to initialize memory roots, which uses the sql error handler to push errors. sql/sql_update.cc: Pass flag to signal fatal error instead of calling fatal_error. sql/tztime.cc: Use init_sql_alloc to initialize memory roots, which uses the sql error handler to push errors.
* | Bug #47788: Crash in TABLE_LIST::hide_view_error on Georgi Kodinov2009-10-191-0/+24
|/ | | | | | | | | | | | | | | UPDATE + VIEW + SP + MERGE + ALTER When cleaning up the stored procedure's internal structures the flag to ignore the errors for INSERT/UPDATE IGNORE was not cleaned up. As a result error ignoring was on during name resolution. And this is an abnormal situation : the SELECT_LEX flag can be on only during query execution. Fixed by correctly cleaning up the SELECT_LEX flag when reusing the SELECT_LEX in a second execution.
* merged 5.0-bugteam to 5.1-bugteamGeorgi Kodinov2009-05-271-0/+13
|\
| * Bug #38159: Function parsing problem generates misleading error messageGeorgi Kodinov2009-05-271-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a more detailed error message on calling an ambiguous missing function. mysql-test/r/ps.result: Bug #38159: fixed existing tests mysql-test/r/sp-error.result: Bug #38159: test case mysql-test/t/ps.test: Bug #38159: fixed existing tests mysql-test/t/sp-error.test: Bug #38159: test case sql/item_func.cc: Bug #38159: generate more detailed error message sql/share/errmsg.txt: Bug #38159: add a more detailed error message sql/sql_derived.cc: Bug #38159: treat the detailed error message the same way as the generic one sql/sql_lex.cc: Bug #38159: - detect if the token is ambiguous and print the appropriate error. - backport is_lex_native_function() from 5.1 sql/sql_lex.h: Bug #38159: detect if the token is ambiguous and print the appropriate error. sql/sql_yacc.yy: Bug #38159: generate more detailed error message sql/table.cc: Bug #38159: treat the detailed error message the same way as the generic one
* | Merging 5.1 main into 5.1-rplMats Kindahl2008-10-231-0/+8
|\ \
| * \ mergingAlexey Botchkov2008-09-301-0/+8
| |\ \ | | |/
| | * Bug#37949 Crash if argument to SP is a subquery that returns more than one row Alexey Botchkov2008-09-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JOIN for the subselect wasn't cleaned if we came upon an error during sub_select() execution. That leads to the assertion failure in close_thread_tables() part of the 6.0 code backported per-file comments: mysql-test/r/sp-error.result Bug#37949 Crash if argument to SP is a subquery that returns more than one row test result mysql-test/t/sp-error.test Bug#37949 Crash if argument to SP is a subquery that returns more than one row test case sql/sp_head.cc Bug#37949 Crash if argument to SP is a subquery that returns more than one row lex->unit.cleanup() call added if not substatement
| | * Bug#33618 (Crash in sp_rcontext)unknown2008-01-231-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 33983 (Stored Procedures: wrong end <label> syntax is accepted) The server used to crash when REPEAT or another control instruction was used in conjunction with labels and a LEAVE instruction. The crash was caused by a missing "pop" of handlers or cursors in the code representing the stored program. When executing the code in a loop, this missing "pop" would result in a stack overflow, corrupting memory. Code generation has been fixed to produce the missing h_pop/c_pop instructions. Also, the logic checking that labels at the beginning and the end of a statement are matched was incorrect, causing Bug 33983. End labels, when used, must match the label used at the beginning of a block. mysql-test/r/sp-code.result: Bug#33618 (Crash in sp_rcontext) mysql-test/r/sp-error.result: Bug 33983 (Stored Procedures: wrong end <label> syntax is accepted) mysql-test/r/sp.result: Bug#33618 (Crash in sp_rcontext) mysql-test/t/sp-code.test: Bug#33618 (Crash in sp_rcontext) mysql-test/t/sp-error.test: Bug 33983 (Stored Procedures: wrong end <label> syntax is accepted) mysql-test/t/sp.test: Bug#33618 (Crash in sp_rcontext) sql/sp_head.cc: Bug#33618 (Crash in sp_rcontext) sql/sp_head.h: Bug#33618 (Crash in sp_rcontext) sql/sp_rcontext.cc: Bug#33618 (Crash in sp_rcontext) sql/sp_rcontext.h: Bug#33618 (Crash in sp_rcontext) sql/sql_yacc.yy: Bug#33618 (Crash in sp_rcontext)
* | | merged 5.1 main to 5.1-rplSven Sandberg2008-08-041-0/+10
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | manually resolved conflicts: Text conflict in client/mysqltest.c Contents conflict in mysql-test/include/have_bug25714.inc Text conflict in mysql-test/include/have_ndbapi_examples.inc Text conflict in mysql-test/mysql-test-run.pl Text conflict in mysql-test/suite/parts/inc/partition_check_drop.inc Text conflict in mysql-test/suite/parts/inc/partition_layout.inc Text conflict in mysql-test/suite/parts/inc/partition_layout_check1.inc Text conflict in mysql-test/suite/parts/inc/partition_layout_check2.inc Text conflict in mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter1_1_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter1_2_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter2_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter3_innodb.result Text conflict in mysql-test/suite/parts/r/partition_alter3_myisam.result Text conflict in mysql-test/suite/parts/r/partition_basic_innodb.result Text conflict in mysql-test/suite/parts/r/partition_basic_myisam.result Text conflict in mysql-test/suite/parts/r/partition_basic_symlink_myisam.result Text conflict in mysql-test/suite/parts/r/partition_engine_myisam.result Text conflict in mysql-test/suite/parts/r/partition_syntax_myisam.result Text conflict in mysql-test/suite/rpl_ndb/t/disabled.def Text conflict in mysql-test/t/disabled.def
| * | Check warnings in servers error log as part of test caseunknown2008-04-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BitKeeper/deleted/.del-rpl_bug33931-slave.opt: Delete: mysql-test/suite/rpl/t/rpl_bug33931-slave.opt mysql-test/include/default_mysqld.cnf: Set a default name for "log-bin" mysql-test/mysql-test-run.pl: Check for warnings in mysqld error log files after each testcase, using SQL mysql-test/lib/mtr_cases.pm: Make mtr_match into a perl module mysql-test/lib/mtr_match.pm: Make mtr_match into a perl module mysql-test/lib/mtr_report.pm: Make mtr_match into a perl module Print warnings if testcase failed from warnings mysql-test/r/information_schema.result: Be more selective which databases and tables are select in the queries mysql-test/r/mysql_upgrade.result: Update result, mysql_upgrade will check _all_ databases mysql-test/r/mysqlcheck.result: Update result, mysql_upgrade should check _all_ databases mysql-test/r/sp-destruct.result: Be more selective which databases and tables are select in the queries mysql-test/r/sp-error.result: Backup and restore mysql.proc table mysql-test/r/sp-security.result: Be more selective which databases and tables are select in the queries mysql-test/r/sp.result: Be more selective which databases and tables are select in the queries mysql-test/suite/rpl/r/rpl_bug33931.result: Move the setting of debug flag into the test file instead of in -slave.opt Add supression mysql-test/suite/rpl/r/rpl_idempotency.result: Add supression Add master-slave-end.inc mysql-test/suite/rpl/t/rpl_bug33931.test: Move the setting of debug flag into the test file instead of in -slave.opt Add supression mysql-test/suite/rpl/t/rpl_idempotency.test: Add supression Add master-slave-end.inc mysql-test/t/information_schema.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp-destruct.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp-error.test: Backup and restore mysql.proc table mysql-test/t/sp-security.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp.test: Be more selective which databases and tables are select in the queries mysql-test/include/check-warnings.test: New BitKeeper file ``mysql-test/include/check-warnings.test'' mysql-test/include/mtr_warnings.sql: New BitKeeper file ``mysql-test/include/mtr_warnings.sql''
* | | A fix for Konstantin Osipov2008-07-031-4/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#12093 "SP not found on second PS execution if another thread drops other SP in between" and Bug#21294 "executing a prepared statement that executes a stored function which was recreat" Stored functions are resolved at prepared statement prepare only. If someone flushes the stored functions cache between prepare and execute, execution fails. The fix is to detect the situation of the cache flush and automatically reprepare the prepared statement after it. mysql-test/r/ps_ddl.result: Update results (Bug#12093 and Bug#21294, the test cases are already in the source tree). mysql-test/r/ps_ddl1.result: Update results (Bug#12093 and Bug#21294, the test cases are already in the source tree). mysql-test/r/sp-error.result: Update results (Bug#12093 and Bug#21294, the test cases are already in the source tree). mysql-test/t/ps_ddl.test: Modify the test to not expect an error where there is no error any more (Bug#12093, Bug#21294). mysql-test/t/ps_ddl1.test: Modify the test to not expect an error where there is no error any more (Bug#12093, Bug#21294). mysql-test/t/sp-error.test: Modify the test to not expect an error where there is no error any more (Bug#12093, Bug#21294). sql/sp_cache.cc: Implement sp_cache_version() -- returns the current version of a stored routines cache. sql/sp_cache.h: Declare sp_cache_version(). sql/sql_prepare.cc: Keep track of stored functions cache version, and invalidate the statement if it changed between prepared statement prepare and execute (and the statement actually uses stored routines).
* | Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal)unknown2008-03-211-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed the parser to reject SQLSTATE '00000', since '00000' is the successful completion condition, and can not be caught by an exception handler in SQL. mysql-test/r/sp-error.result: Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal) mysql-test/t/sp-error.test: Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal) sql/sp_pcontext.cc: Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal)
* | Bug#21801 SQL exception handlers and warningsunknown2008-02-041-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that deprecated syntax warnings were not being suppressed when the stored routine is being parsed for the first execution. It's doesn't make sense to print out deprecated syntax warnings when the routine is being executed because this kind of warning only matters when the routine is being created. The solution is to suppress deprecated syntax warnings when parsing the stored routine for loading into the cache (might mean that the routine is being executed for the first time). mysql-test/r/sp-error.result: Add test case result for Bug#21801 mysql-test/t/sp-error.test: Add test case for Bug#21801 sql/sp.cc: Implement a internal error handler to catch deprecated syntax warnings when loading a stored procedure into the cache.
* | Manual mergeunknown2008-01-231-0/+63
| |
* | Bug#30882 Dropping a temporary table inside a stored function may cause a ↵unknown2007-11-011-5/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | server crash If a stored function that contains a drop temporary table statement is invoked by a create temporary table of the same name may cause a server crash. The problem is that when dropping a table no check is done to ensure that table is not being used by some outer query (or outer statement), potentially leaving the outer query with a reference to a stale (freed) table. The solution is when dropping a temporary table, always check if the table is being used by some outer statement as a temporary table can be dropped inside stored procedures. The check is performed by looking at the TABLE::query_id value for temporary tables. To simplify this check and to solve a bug related to handling of temporary tables in prelocked mode, this patch changes the way in which this member is used to track the fact that table is used/unused. Now we ensure that TABLE::query_id is zero for unused temporary tables (which means that all temporary tables which were used by a statement should be marked as free for reuse after it's execution has been completed). mysql-test/include/handler.inc: Add test case for side effect of Bug#30882 mysql-test/r/handler_innodb.result: Add test case result for side effect of Bug#30882 mysql-test/r/handler_myisam.result: Add test case result for side effect of Bug#30882 mysql-test/r/sp-error.result: Add test case result for Bug#30882 mysql-test/t/sp-error.test: Add test case for Bug#30882 sql/event_db_repository.cc: Update close_thread_tables call, no more default values. sql/mysql_priv.h: Remove implicit default parameters values of the close_thread_tables function as no callers are using it. sql/slave.cc: Update close_thread_tables call, no more default values sql/sp_head.cc: Update close_thread_tables call, no more default values sql/sql_base.cc: Changed the approach to distinguishing currently unused temporary tables. Now we ensure that such tables always have TABLE::query_id set to 0 and use this fact to perform checks during opening and dropping of temporary tables. This means that we have to call close_thread_tables() even for statements which use only temporary tables. To make this call cheaper, we re-factored close_thread_tables() to not take LOCK_open unless there are open base tables. sql/sql_handler.cc: Properly close temporary tables associated with a handler. sql/sql_insert.cc: close_temporary_table is now merged into drop_temporary_table. sql/sql_parse.cc: Now the condition doesn't cover all cases because close_thread_tables() must be called even for statements that use only temporary tables. sql/sql_table.cc: Use drop_temporary_table which perform checks to verify if the table is not being used. Error path problem is due to a handler tables issue and is going to be addressed in bug 31397. sql/table.h: Rename previously unused clear_query_id and document the usage of query_id and open_by_handler.
* | Bug#30904 SET PASSWORD statement is non-transactionalunknown2007-10-301-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SET PASSWORD statement is non-transactional (no explicit transaction boundaries) in nature and hence is forbidden inside stored functions and triggers, but it weren't being effectively forbidden. The implemented fix is to issue a implicit commit with every SET PASSWORD statement, effectively prohibiting these statements in stored functions and triggers. mysql-test/r/sp-error.result: Add test case result for Bug#30904 mysql-test/t/sp-error.test: Add test case for Bug#30904 sql/sql_lex.h: Add variable to set that a statement with SET PASSWORD causes a implicit commit. sql/sql_parse.cc: End active transaction in SET PASSWORD. sql/sql_yacc.yy: Set the correct flag on SET PASSWORD if inside a SP, thus effectively prohibiting SET PASSWORD statements in stored functions and triggers.
* | Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-runtimeunknown2007-10-161-1/+24
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge mysql-test/t/sp-error.test: Auto merged mysql-test/t/udf.test: Auto merged sql/item.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_udf.cc: Auto merged mysql-test/r/sp-error.result: failed auto merge mysql-test/r/sp.result: failed auto merge mysql-test/r/udf.result: failed auto merge mysql-test/t/sp.test: failed auto merge sql/sp_head.cc: failed auto merge sql/sql_yacc.yy: failed auto merge
| * Bug#28318 (CREATE FUNCTION (UDF) requires a schema) -- part IIunknown2007-10-151-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The root cause of the issue was that the CREATE FUNCTION grammar, for User Defined Functions, was using the sp_name rule. The sp_name rule is intended for fully qualified stored procedure names, like either ident.ident, or just ident but with a default database implicitly selected. A UDF does not have a fully qualified name, only a name (ident), and should not use the sp_name grammar fragment during parsing. The fix is to re-organize the CREATE FUNCTION grammar, to better separate: - creating UDF (no definer, can have AGGREGATE, simple ident) - creating Stored Functions (definer, no AGGREGATE, fully qualified name) With the test case provided, another issue was exposed which is also fixed: the DROP FUNCTION statement was using sp_name and also failing when no database is implicitly selected, when droping UDF functions. The fix is also to change the grammar so that DROP FUNCTION works with both the ident.ident syntax (to drop a stored function), or just the ident syntax (to drop either a UDF or a Stored Function, in the current database) mysql-test/r/sp-error.result: Adjust test results mysql-test/r/udf.result: Adjust test results mysql-test/t/sp-error.test: Adjust test results mysql-test/t/udf.test: Adjust test results sql/sql_parse.cc: CREATE UDF FUNCTION does not use a fully qualified name. sql/sql_yacc.yy: Fix grammar for CREATE / DROP FUNCTION, FOR udf Improve error messages for select no_such_function()
| * Bug#28318 CREATE FUNCTION (UDF) requires a schemaunknown2007-10-091-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#29816 Syntactically wrong query fails with misleading error message The core problem is that an SQL-invoked function name can be a <schema qualified routine name> that contains no <schema name>, but the mysql parser insists that all stored procedures (function, procedures and triggers) must have a <schema name>, which is not true for functions. This problem is especially visible when trying to create a function or when a query contains a syntax error after a function call (in the same query), both will fail with a "No database selected" message if the session is not attached to a particular schema, but the first one should succeed and the second fail with a "syntax error" message. Part of the fix is to revamp the sp name handling so that a schema name may be omitted for functions -- this means that the internal function name representation may not have a dot, which represents that the function doesn't have a schema name. The other part is to place schema checks after the type (function, trigger or procedure) of the routine is known. mysql-test/r/sp-error.result: Add test case result for Bug#29816 mysql-test/r/udf.result: Add test case result for Bug#28318 mysql-test/t/sp-error.test: Add test case for Bug#29816 mysql-test/t/udf.test: Add test case for Bug#28318 sql/sp.cc: Copy the (last) nul byte of the stored routine key and move name parsing code to the sp_name class constructor. sql/sp_head.cc: Revamp routine name parsing for when no schema is specified and omit dot from the qualified name if the routine is not associated with a scheme name. sql/sp_head.h: Name parsing got bigger, uninline by moving to a single unit -- the sp_head.cc file. sql/sql_yacc.yy: Only copy the schema name if one is actually set and check for schema name presence only where it's necessary.
* | Bug#29223 declare cursor c for SHOW .....unknown2007-10-111-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "DECLARE CURSOR FOR SHOW ..." is a syntax that currently appears to work, but is untested for some SHOW commands and does not work for other SHOW commands. Since this is an un-intended feature that leaked as a result of a coding bug (in the parser grammar), the correct fix is to fix the grammar to not accept this construct. In other words, "DECLARE CURSOR FOR SHOW <other commands that don't work>" is not considered a bug, and we will not implement other features to make all the SHOW commands usable inside a cursor just because someone exploited a bug. mysql-test/r/sp-error.result: Only allow declaring cursors for SELECT statements to avoid possible further confusion/problems. mysql-test/t/information_schema.test: Only SELECT statements are allowed in cursors. mysql-test/t/sp-error.test: Add test case for Bug#29223. Non-SELECT statements in cursors now yields a parser error. sql/sql_yacc.yy: Rework DECLARE CURSOR statement to not allow non-SELECT statements.
* | WL#4030 (Deprecate RENAME DATABASE: replace with ALTER DATABASE <name>unknown2007-09-101-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UPGRADE) Bug 17565 (RENAME DATABASE destroys events) Bug#28360 (RENAME DATABASE destroys routines) Removed the RENAME DATABASE db1 TO db2 statement. Implemented the ALTER DATABASE db UPGRADE DATA DIRECTORY NAME statement, which has the same function. client/mysqlcheck.c: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/create.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/query_cache.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/renamedb.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/sp-code.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/sp-error.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/r/upgrade.result: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/create.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/query_cache.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/renamedb.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/sp-error.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME mysql-test/t/upgrade.test: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/mysql_priv.h: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_lex.h: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_parse.cc: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_prepare.cc: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_yacc.yy: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME sql/sql_db.cc: ALTER DATABASE db UPGRADE DATA DIRECTORY NAME
* | Bug#21975 Grant and revoke statements are non-transactionalunknown2007-08-291-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#21422 GRANT/REVOKE possible inside stored function, probably in a trigger Bug#17244 GRANT gives strange error message when used in a stored function GRANT/REVOKE statements are non-transactional (no explicit transaction boundaries) in nature and hence are forbidden inside stored functions and triggers, but they weren't being effectively forbidden. Furthermore, the absence of implict commits makes changes made by GRANT/REVOKE statements to not be rolled back. The implemented fix is to issue a implicit commit with every GRANT/REVOKE statement, effectively prohibiting these statements in stored functions and triggers. The implicit commit also fixes the replication bug, and looks like being in concert with the behavior of DDL and administrative statements. Since this is a incompatible change, the following sentence should be added to the Manual in the very end of the 3rd paragraph, subclause 13.4.3 "Statements That Cause an Implicit Commit": "Beginning with MySQL 5.0.??, the GRANT and REVOKE statements cause an implicit commit." Patch contributed by Vladimir Shebordaev mysql-test/r/sp-error.result: Test case result for Bug#17244 mysql-test/t/sp-error.test: Test case for Bug#17244 sql/sp_head.cc: Set that a procedure with GRANT/REVOKE command has a (implicit or explicit) commit. sql/sql_parse.cc: End active transaction in SQLCOM_GRANT and SQLCOM_REVOKE, and thus effectively prohibit these statements in stored functions and triggers. An implicit commit also fixes a bug in replication, when GRANT or REVOKE would disappear from the binary log in case of a subsequent ROLLBACK, since they were considered transactional statements. mysql-test/suite/rpl/r/rpl_binlog_grant.result: Add test case result for Bug#21975 mysql-test/suite/rpl/t/rpl_binlog_grant.test: Add test case for Bug#21975
* | Merge adventure.(none):/home/thek/Development/cpp/bug28846/my51-bug28846unknown2007-06-221-5/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into adventure.(none):/home/thek/Development/cpp/mysql-5.1-runtime mysql-test/t/sp-error.test: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Auto merged
| * \ Merge adventure.(none):/home/thek/Development/cpp/bug28846/my50-bug28846unknown2007-06-221-5/+5
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into adventure.(none):/home/thek/Development/cpp/bug28846/my51-bug28846 mysql-test/r/ps_1general.result: Auto merged mysql-test/r/sp-dynamic.result: Auto merged mysql-test/r/sp-error.result: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/sp-error.test: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Manual merge 5.0->5.1
| | * Bug#28846 Use of undocumented Prepared Statements crashes serverunknown2007-06-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ALTER VIEW is currently not supported as a prepared statement and should be disabled as such as they otherwise could cause server crashes. ALTER VIEW is currently not supported when called from stored procedures or functions for related reasons and should also be disabled. This patch disables these DDL statements and adjusts the appropriate test cases accordingly. Additional tests has been added to reflect on the fact that we do support CREATE/ALTER/DROP TABLE for Prepared Statements (PS), Stored Procedures (SP) and PS within SP. mysql-test/r/ps_1general.result: - Updated test to reflect on the new policy to disallow ALTER VIEW within SP. mysql-test/r/sp-dynamic.result: - Added PS ALTER TABLE test from within SP-context to demonstrate that CREATE/ALTER/DROP TABLE statements is working. - Added PS CREATE/ALTER/DROP VIEW tests from within SP-context to show that ALTER VIEW is not supported, CREATE VIEW/DROP VIEW are supported. mysql-test/r/sp-error.result: - Updated test to reflect on the new policy to disallow VIEW DDL within SP. mysql-test/t/ps_1general.test: - Updated test to reflect on the new policy to disallow VIEW DDL within SP. mysql-test/t/sp-dynamic.test: - Add PS ALTER TABLE test from within SP to demonstrate that CREATE/ALTER/DROP TABLE statements are supported. mysql-test/t/sp-error.test: - Updated test to reflect on the new policy to disallow ALTER VIEW within SP-context. - Changed error code 1314 to the more abstract ER_SP_BADSTATEMENT. sql/sql_class.h: - Added comment for clarity sql/sql_parse.cc: - Added comment for clarity sql/sql_prepare.cc: - Disallow ALTER VIEW as prepared statements until they are properly supported. Note that SQLCOM_CREATE_VIEW also handles ALTER VIEW statements. sql/sql_view.cc: - converted to doxygen comments - Added comment for clarity sql/sql_yacc.yy: - Disallow ALTER VIEW statements within a SP. If the parser is operating within the SP context, this is shown on the sp->sphead pointer. If this flag is set for view DDL operations we stop parsing with the error 'ER_SP_BAD_STATEMENT'.
* | | Bug #28842 Different 'duplicate key' error code between 5.0 and 5.1unknown2007-06-061-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch for WL 1563 added a new duplicate key error message so that the key name could be provided instead of the key number. But the error code for the new message was used even though that did not need to change. This could cause unnecessary problems for applications that used the old ER_DUP_ENTRY error code to detect duplicate key errors. mysql-test/t/auto_increment.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/create.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/create_select_tmp.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ctype_ucs2_def.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ctype_utf8.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/delayed.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/heap.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/heap_btree.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/heap_hash.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/innodb.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/insert_select.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/insert_update.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/join_outer.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/key.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/merge.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/myisam.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_basic.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_charset.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_index_unique.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_insert.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_replace.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/ndb_update.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/replace.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_err_ignoredtable.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_ndb_do_table.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_row_create_table.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/rpl_sp.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/show_check.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp-error.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp_trans.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/sp_trans_log.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/temp_table.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_binary.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_bit.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_bit_innodb.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_blob.test: Update ER_DUP_ENTRY-related error message values mysql-test/t/type_varchar.test: Update ER_DUP_ENTRY-related error message values mysql-test/r/create.result: Update ER_DUP_ENTRY-related error message values mysql-test/r/rpl_sp.result: Update ER_DUP_ENTRY-related error message values mysql-test/r/sp.result: Update ER_DUP_ENTRY-related error message values mysql-test/include/mix1.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/mix2.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/ps_modify.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/query_cache.inc: Update ER_DUP_ENTRY-related error message values mysql-test/include/varchar.inc: Update ER_DUP_ENTRY-related error message values mysql-test/extra/binlog_tests/insert_select-binlog.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_auto_increment.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_foreign_key.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_insert_delayed.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_insert_id.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_insert_id_pk.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_loaddata.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_row_basic.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test: Update ER_DUP_ENTRY-related error message values mysql-test/extra/rpl_tests/rpl_trig004.test: Update ER_DUP_ENTRY-related error message values sql/handler.cc: Restore use of ER_DUP_ENTRY error code even when ER_DUP_ENTRY_WITH_KEY_NAME error message is being used. (Bug #28842)
* | Merge vajra.(none):/opt/local/work/mysql-5.0-runtimeunknown2007-05-181-3/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into vajra.(none):/opt/local/work/mysql-5.1-runtime mysql-test/r/sp-error.result: Auto merged mysql-test/r/sp-prelocking.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/t/sp-error.test: Auto merged mysql-test/t/sp-prelocking.test: Auto merged mysql-test/t/trigger.test: Auto merged sql/sql_base.cc: Auto merged