summaryrefslogtreecommitdiff
path: root/sql/sp.cc
Commit message (Collapse)AuthorAgeFilesLines
* Manual merge of mysql-next-mr-runtime upstream.Davi Arnaut2009-11-191-0/+3
|\
| * Backport of Bug#32140 to mysql-next-mrDavi Arnaut2009-11-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------ revno: 2618 revision-id: sp1r-davi@mysql.com/endora.local-20080418131946-26951 parent: sp1r-davi@mysql.com/endora.local-20080417190810-26185 committer: davi@mysql.com/endora.local timestamp: Fri 2008-04-18 10:19:46 -0300 message: Bug#32140: wrong error code caught when an SF() call is interruped with KILL query The problem is that killing a query which calls a stored function could return a wrong error (table corrupt) instead of the query interrupted error message. The solution is to not set the table corrupt error if the query is killed, the query interrupted error message will be set later when the query is finished.
* | Manual merge from mysql-trunk-merge.Alexander Nozdrin2009-11-051-2/+2
|\ \ | |/ |/|
| * Bug #40877: multi statement execution fails in 5.1.30Georgi Kodinov2009-10-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented the server infrastructure for the fix: 1. Added a function LEX_STRING *thd_query_string(THD) to return a LEX_STRING structure instead of char *. This is the function that must be called in innodb instead of thd_query() 2. Did some encapsulation in THD : aggregated thd_query and thd_query_length into a LEX_STRING and made accessor and mutator methods for easy code updating. 3. Updated the server code to use the new methods where applicable.
* | Backport of:Konstantin Osipov2009-10-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------------------------------------- revno: 2617.22.5 committer: Konstantin Osipov <kostja@sun.com> branch nick: mysql-6.0-runtime timestamp: Tue 2009-01-27 05:08:48 +0300 message: Remove non-prefixed use of HASH. Always use my_hash_init(), my_hash_inited(), my_hash_search(), my_hash_element(), my_hash_delete(), my_hash_free() rather than non-prefixed counterparts (hash_init(), etc). Remove the backward-compatible defines.
* | WL#2110 (SIGNAL)Marc Alff2009-09-101-7/+15
|/ | | | | | | WL#2265 (RESIGNAL) Manual merge of SIGNAL and RESIGNAL to mysql-trunk-signal, plus required dependencies.
* BUG#41166 stored function requires "deterministic" if binlog_format is ↵Alfranio Correia2009-07-281-3/+0
| | | | | | | | | | | | | "statement" If the log_bin_trust_function_creators option is not defined, creating a stored function requires either one of the modifiers DETERMINISTIC, NO SQL, or READS SQL DATA. Executing a stored function should also follows the same rules if in STATEMENT mode. However, this was not happening and a wrong error was being printed out: ER_BINLOG_ROW_RBR_TO_SBR. The patch makes the creation and execution compatible and prints out the correct error ER_BINLOG_UNSAFE_ROUTINE when a stored function without one of the modifiers above is executed in STATEMENT mode.
* BUG#41948 Query_log_event constructor needlessly contortedHe Zhenxing2009-05-301-1/+1
| | | | | Make the caller of Query_log_event, Execute_load_log_event constructors and THD::binlog_query to provide the error code instead of having the constructors to figure out the error code.
* Bug#44658 Create procedure makes server crash when user does not have ALL ↵Kristofer Pettersson2009-05-291-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | privilege MySQL crashes if a user without proper privileges attempts to create a procedure. The crash happens because more than one error state is pushed onto the Diagnostic area. In this particular case the user is denied to implicitly create a new user account with the implicitly granted privileges ALTER- and EXECUTE ROUTINE. The new account is needed if the original user account contained a host mask. A user account with a host mask is a distinct user account in this context. An alternative would be to first get the most permissive user account which include the current user connection and then assign privileges to that account. This behavior change is considered out of scope for this bug patch. The implicit assignment of privileges when a user creates a stored routine is a considered to be a feature for user convenience and as such it is not a critical operation. Any failure to complete this operation is thus considered non-fatal (an error becomes a warning). The patch back ports a stack implementation of the internal error handler interface. This enables the use of multiple error handlers so that it is possible to intercept and cancel errors thrown by lower layers. This is needed as a error handler already is used in the call stack emitting the errors which needs to be converted.
* Manually merge BUG#37145 to 5.1-bugteamHe Zhenxing2009-04-091-1/+2
|\
| * BUG#37145 Killing a statement doing DDL may log binlog event with error code ↵He Zhenxing2009-03-271-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1053 When the thread executing a DDL was killed after finished its execution but before writing the binlog event, the error code in the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED. This patch fixed the problem by ignoring the kill status when constructing the event for DDL statements. This patch also included the following changes in order to provide the test case. 1) modified mysqltest to support variable for connection command 2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to run mysql client against the slave mysqld.
| * Bug#29125 Windows Server X64: so many compiler warningsIgnacio Galarza2009-02-101-5/+5
| | | | | | | | | | - Remove bothersome warning messages. This change focuses on the warnings that are covered by the ignore file: support-files/compiler_warnings.supp. - Strings are guaranteed to be max uint in length
* | BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURELeonard Zhou2009-02-281-1/+3
| | | | | | | | | | | | | | Set wrong sql_mode when creating a procedure. So that the sql_mode can't be writen into binary log correctly. Restore the current session sql_mode right before generating the binlog event when creating a procedure.
* | Bug#35577, manual merge mysql-5.0-bugteam -> mysql-5.1-bugteamMarc Alff2008-07-141-2/+2
|\ \ | |/
| * Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending onMarc Alff2008-07-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | build) The crash was caused by freeing the internal parser stack during the parser execution. This occured only for complex stored procedures, after reallocating the parser stack using my_yyoverflow(), with the following C call stack: - MYSQLparse() - any rule calling sp_head::restore_lex() - lex_end() - x_free(lex->yacc_yyss), xfree(lex->yacc_yyvs) The root cause is the implementation of stored procedures, which breaks the assumption from 4.1 that there is only one LEX structure per parser call. The solution is to separate the LEX structure into: - attributes that represent a statement (the current LEX structure), - attributes that relate to the syntax parser itself (Yacc_state), so that parsing multiple statements in stored programs can create multiple LEX structures while not changing the unique Yacc_state. Now, Yacc_state and the existing Lex_input_stream are aggregated into Parser_state, a structure that represent the complete state of the (Lexical + Syntax) parser.
* | Merge bk-internal.mysql.com:/home/bk/mysql-5.1kostja@bodhi.(none)2008-05-201-204/+0
|\ \ | | | | | | | | | into bodhi.(none):/opt/local/work/mysql-5.1-27430
| * | Remove dead code.kostja@dipika.(none)2008-04-081-204/+0
| | |
* | | Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my50-bug36570cmiller@zippy.cornsilk.net2008-05-151-13/+23
|\ \ \ | | |/ | |/| | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my51-bug36570
| * | Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on \cmiller@zippy.cornsilk.net2008-05-151-23/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | slave The stored-routine code took the contents of the (lowest) parser and copied it directly to the binlog, which causes problems if there is a special case of interpretation at the parser level -- which there is, in the "/*!VER */" comments. The trailing "*/" caused errors on the slave, naturally. Now, since by that point we have /properly/ created parse-tree (as the rest of the server should do!) for the stored-routine CREATE, we can construct a perfect statement from that information, instead of writing uncertain information from an unknown parser state. Fortunately, there's already a function nearby that does exactly that. --- Update for Bug#36570. Qualify routine names with db name when writing to the binlog ONLY if the source text is qualified.
* | | Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my50-bug36570cmiller@zippy.cornsilk.net2008-05-151-16/+18
|\ \ \ | |_|/ |/| | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my51-bug36570
| * | Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on \cmiller@zippy.cornsilk.net2008-05-141-13/+19
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | slave The stored-routine code took the contents of the (lowest) parser and copied it directly to the binlog, which causes problems if there is a special case of interpretation at the parser level -- which there is, in the "/*!VER */" comments. The trailing "*/" caused errors on the slave, naturally. Now, since by that point we have /properly/ created parse-tree (as the rest of the server should do!) for the stored-routine CREATE, we can construct a perfect statement from that information, instead of writing uncertain information from an unknown parser state. Fortunately, there's already a function nearby that does exactly that.
* | Merge kaamos.(none):/data/src/mysql-5.1kaa@kaamos.(none)2008-03-121-0/+6
|\ \ | | | | | | | | | into kaamos.(none):/data/src/opt/mysql-5.1-opt
| * \ Merge magare.gmz:/home/kgeorge/mysql/work/B30604-5.0-optgkodinov/kgeorge@magare.gmz2008-02-221-0/+6
| |\ \ | | |/ | | | | | | into magare.gmz:/home/kgeorge/mysql/work/B30604-5.1-opt
| | * Bug #30604: different flagging of time_zone_used in normal gkodinov/kgeorge@magare.gmz2008-02-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and ps-protocol Finding a routine should be a transparent operation as far as the binary log is concerned. But it was influencing the binary log because of the TIMESTAMP column in the proc table. Fixed by preserving and restoring the time_zone usage flag when searching for a stored routine in the proc table.
| | * Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opttnurnberg@white.intern.koehntopp.de2007-12-171-1/+1
| | |\ | | | | | | | | | | | | into mysql.com:/misc/mysql/31752_/50-31752_
| | | * Bug#31752: check strmake() boundstnurnberg@mysql.com/white.intern.koehntopp.de2007-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | strmake() called with wrong parameters: 5.0-specific fixes.
* | | | Rename send_eof() to my_eof() for consistency with my_ok() and my_error()kostja@dipika.(none)2008-02-191-1/+1
| | | |
* | | | Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtimekostja@dipika.(none)2008-02-191-3/+17
|\ \ \ \ | |/ / / |/| | | | | | | into dipika.(none):/opt/local/work/mysql-5.1-2pc-opt-merge-push
| * | | A fix and a test case for Bug#12713 "Error in a stored function called from kostja@dipika.(none)2008-02-191-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a SELECT doesn't cause ROLLBACK of statem". The idea of the fix is to ensure that we always commit the current statement at the end of dispatch_command(). In order to not issue redundant disc syncs, an optimization of the two-phase commit protocol is implemented to bypass the two phase commit if the transaction is read-only.
* | | | Merge mysql.com:/Users/davi/mysql/bugs/32633-5.1davi@endora.local2008-02-071-2/+11
|\ \ \ \ | | | | | | | | | | | | | | | into mysql.com:/Users/davi/mysql/mysql-5.1-runtime
| * | | | Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitutiondavi@mysql.com/endora.local2008-02-071-2/+11
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that one can not create a stored routine if sql_mode contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when a event is created, the mode is silently lost if sql_mode contains one of the aforementioned. This was happening because the table definitions which stored sql_mode values weren't being updated to accept new values of sql_mode. The solution is to update, in a backwards compatible manner, the various table definitions (columns) that store the sql_mode value to take into account the new possible values. One incompatible change is that if a event that is being created can't be stored to the mysql.event table, an error will be raised. The tests case also ensure that new SQL modes will be added to the mysql.proc and mysql.event tables, otherwise the tests will fail.
* | | | Bug#21801 SQL exception handlers and warningsdavi@mysql.com/endora.local2008-02-041-1/+29
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | | Merge bk-internal.mysql.com:/home/bk/mysql-5.1-maintcmiller@zippy.cornsilk.net2007-12-141-182/+171
|\ \ \ | | | | | | | | | | | | into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
| * | | Doxygenized comments.cmiller@zippy.cornsilk.net2007-10-111-182/+171
| | | |
* | | | Use an inline getter method (thd->is_error()) to query if there is an error kostja@bodhi.(none)2007-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | in THD. In future the error may be stored elsewhere (not in net.report_error) and it's important to start using an opaque getter to simplify merges.
* | | | Fix for BUG#24923: Functions with ENUM issues.anozdrin/alik@station.2007-10-171-39/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the RETURNS column in the mysql.proc was of CHAR(64). That was not enough for storing long-named datatypes. The fix is to change CHAR(64) to LONGBLOB, and to throw warnings at the time a stored routine is created if some data is truncated during writing into mysql.proc.
* | | | Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-runtimemalff@lambda.hsd1.co.comcast.net.2007-10-161-10/+3
|\ \ \ \ | |/ / / |/| / / | |/ / into lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge
| * | Bug#28318 CREATE FUNCTION (UDF) requires a schemadavi@virtua-cwbas201-21-158-74.ctb.virtua.com.br2007-10-091-10/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Eliminate compile warnings.anozdrin/alik@ibm.opbmk2007-09-011-1/+2
| |
* | Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtimeanozdrin/alik@ibm.opbmk2007-08-311-106/+42
|\ \ | | | | | | | | | into ibm.opbmk:/home/alik/Documents/MySQL/devel/5.1-rt-bug25843
| * | Fix for BUG#25843: changing default database between PREPARE and EXECUTEanozdrin/alik@ibm.opbmk2007-08-311-106/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of statement breaks binlog. There were two problems discovered by this bug: 1. Default (current) database is not fixed at the creation time. That leads to wrong output of DATABASE() function. 2. Database attributes (@@collation_database) are not fixed at the creation time. That leads to wrong resultset. Binlog breakage and Query Cache wrong output happened because of the first problem. The fix is to remember the current database at the PREPARE-time and set it each time at EXECUTE.
* | | Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-basemalff/marcsql@weblab.(none)2007-08-301-25/+32
|\ \ \ | |/ / | | | | | | into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt50-merge
| * | Cleanup-patch for BUG#25843: changing default database betweenanozdrin/alik@ibm.opbmk2007-08-301-25/+32
| | | | | | | | | | | | PREPARE and EXECUTE of statement breaks binlog.
* | | Merge hynda.mysql.fi:/home/my/mysql-5.1-mainjani@hynda.mysql.fi2007-08-221-6/+7
|\ \ \ | |/ / |/| | | | | into hynda.mysql.fi:/home/my/mysql-5.1-marvel
| * | Fixed a lot of compiler warnings and errors detected by Forte C++ on Solarismonty@mysql.com/nosik.monty.fi2007-08-131-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Faster thr_alarm() Added 'Opened_files' status variable to track calls to my_open() Don't give warnings when running mysql_install_db Added option --source-install to mysql_install_db I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map()
* | | Fix doxygen warnings.kostja@bodhi.(none)2007-08-151-1/+1
|/ /
* | Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtimemalff/marcsql@weblab.(none)2007-07-271-1/+1
|\ \ | | | | | | | | | into weblab.(none):/home/marcsql/TREE/mysql-5.1-25422-d
| * | WL#3984 (Revise locking of mysql.general_log and mysql.slow_log)malff/marcsql@weblab.(none)2007-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#25422 (Hang with log tables) Bug 17876 (Truncating mysql.slow_log in a SP after using cursor locks the thread) Bug 23044 (Warnings on flush of a log table) Bug 29129 (Resetting general_log while the GLOBAL READ LOCK is set causes a deadlock) Prior to this fix, the server would hang when performing concurrent ALTER TABLE or TRUNCATE TABLE statements against the LOG TABLES, which are mysql.general_log and mysql.slow_log. The root cause traces to the following code: in sql_base.cc, open_table() if (table->in_use != thd) { /* wait_for_condition will unlock LOCK_open for us */ wait_for_condition(thd, &LOCK_open, &COND_refresh); } The problem with this code is that the current implementation of the LOGGER creates 'fake' THD objects, like - Log_to_csv_event_handler::general_log_thd - Log_to_csv_event_handler::slow_log_thd which are not associated to a real thread running in the server, so that waiting for these non-existing threads to release table locks cause the dead lock. In general, the design of Log_to_csv_event_handler does not fit into the general architecture of the server, so that the concept of general_log_thd and slow_log_thd has to be abandoned: - this implementation does not work with table locking - it will not work with commands like SHOW PROCESSLIST - having the log tables always opened does not integrate well with DDL operations / FLUSH TABLES / SET GLOBAL READ_ONLY With this patch, the fundamental design of the LOGGER has been changed to: - always open and close a log table when writing a log - remove totally the usage of fake THD objects - clarify how locking of log tables is implemented in general. See WL#3984 for details related to the new locking design. Additional changes (misc bugs exposed and fixed): 1) mysqldump which would ignore some tables in dump_all_tables_in_db(), but forget to ignore the same in dump_all_views_in_db(). 2) mysqldump would also issue an empty "LOCK TABLE" command when all the tables to lock are to be ignored (numrows == 0), instead of not issuing the query. 3) Internal errors handlers could intercept errors but not warnings (see sql_error.cc). 4) Implementing a nested call to open tables, for the performance schema tables, exposed an existing bug in remove_table_from_cache(), which would perform: in_use->some_tables_deleted=1; against another thread, without any consideration about thread locking. This call inside remove_table_from_cache() was not required anyway, since calling mysql_lock_abort() takes care of aborting -- cleanly -- threads that might hold a lock on a table. This line (in_use->some_tables_deleted=1) has been removed.
* | | Merge ibm.:/home/alik/Documents/MySQL/devel/5.0-rtanozdrin/alik@ibm.2007-07-271-2/+2
|\ \ \ | |/ / |/| / | |/ into ibm.:/home/alik/Documents/MySQL/devel/5.1-rt-merge
| * Allow mysql.proc to have extra (unknown) fields.anozdrin/alik@ibm.2007-07-251-2/+2
| | | | | | | | This allows 5.0 to work with 5.1 databases.