From 9036f1aa97ad0a46a338b70673327dd3d8192eee Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Thu, 5 Feb 2009 10:16:00 +0400 Subject: Bug#37995 Error message truncation in test "innodb" in embedded mode. code backported from 6.0 per-file messages: include/my_global.h Remove SC_MAXWIDTH. This is unused and irrelevant nowadays. include/my_sys.h Remove errbuf declaration and unused definitions. mysys/my_error.c Remove errbuf definition and move and adjust ERRMSGSIZE. mysys/my_init.c Declare buffer on the stack and use my_snprintf. mysys/safemalloc.c Use size explicitly. It's more than enough for the message at hand. sql/sql_error.cc Use size explicitly. It's more than enough for the message at hand. sql/sql_parse.cc Declare buffer on the stack. Use my_snprintf as it will result in less stack space being used than by a system provided sprintf -- this allows us to put the buffer on the stack without causing much trouble. Also, the use of errbuff here was not thread-safe as the function can be entered concurrently from multiple threads. sql/sql_table.cc Use MYSQL_ERRMSG_SIZE. Extra space is not needed as my_snprintf will nul terminate strings. storage/myisam/ha_myisam.cc Use MYSQL_ERRMSG_SIZE. sql/share/errmsg.txt Error message truncation in test "innodb" in embedded mode filename in the error message can safely take up to 210 symbols. --- sql/sql_parse.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 99b131c3aef..592dbe9f43b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5454,9 +5454,10 @@ bool check_stack_overrun(THD *thd, long margin, if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >= (long) (my_thread_stack_size - margin)) { - sprintf(errbuff[0],ER(ER_STACK_OVERRUN_NEED_MORE), - stack_used,my_thread_stack_size,margin); - my_message(ER_STACK_OVERRUN_NEED_MORE,errbuff[0],MYF(0)); + char ebuff[MYSQL_ERRMSG_SIZE]; + my_snprintf(ebuff, sizeof(ebuff), ER(ER_STACK_OVERRUN_NEED_MORE), + stack_used, my_thread_stack_size, margin); + my_message(ER_STACK_OVERRUN_NEED_MORE, ebuff, MYF(ME_FATALERROR)); thd->fatal_error(); return 1; } -- cgit v1.2.1 From b7b6773f6967e3e8d0514cd09477d75d6485c85e Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 10 Feb 2009 11:52:19 +0100 Subject: BUG#13684: SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if routine does not exist There is an inconsistency with DROP DATABASE IF EXISTS, DROP TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even if the DB or TABLE does not exist, whereas DROP PROCEDURE IF EXISTS does not. It would be nice or at least consistent if DROP PROCEDURE/STATEMENT worked the same too. Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to write_bin_log in mysql_execute_command. Checked also if all documented "DROP (...) IF EXISTS" get binlogged. Left out DROP SERVER IF EXISTS because it seems that it only gets binlogged when using row event (see BUG#25705). --- sql/sql_parse.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 592dbe9f43b..7c5f469da41 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4427,6 +4427,7 @@ create_sp_error: case SP_KEY_NOT_FOUND: if (lex->drop_if_exists) { + write_bin_log(thd, TRUE, thd->query, thd->query_length); push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST), SP_COM_STRING(lex), lex->spname->m_name.str); -- cgit v1.2.1 From d3a10ec6efdf8a257935a8f6161ca83d5538ce6b Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 16 Feb 2009 08:38:15 -0300 Subject: Bug#41077: Warning contains wrong future version Substitute all references of MySQL version "5.2" to "6.0" in deprecation warning messages.Deprecated constructs are being removed in the 6.0 tree. --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7c5f469da41..f7d6d5bac4d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5967,7 +5967,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type, */ char buf[32]; my_snprintf(buf, sizeof(buf), "TIMESTAMP(%s)", length); - WARN_DEPRECATED(thd, "5.2", buf, "'TIMESTAMP'"); + WARN_DEPRECATED(thd, "6.0", buf, "'TIMESTAMP'"); } if (!(new_field= new Create_field()) || -- cgit v1.2.1 From ddaede8087c66bfd28a5a9e74d26143254deb63a Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Thu, 5 Mar 2009 15:22:33 +0100 Subject: Bug#39843 DELETE requires write access to table in subquery in where clause An unnecessarily restrictive lock were taken on sub-SELECTs during DELETE. During parsing, a global structure is reused for sub-SELECTs and the attribute keeping track of lock options were not reset properly. This patch introduces a new attribute to keep track on the syntactical lock option elements found in a sub-SELECT and then sets the lock options accordingly. Now the sub-SELECTs will try to acquire a READ lock if possible instead of a WRITE lock as inherited from the outer DELETE statement. mysql-test/r/lock.result: Added test case for bug39843 mysql-test/t/lock.test: Added test case for bug39843 sql/sql_lex.cc: * Reset member variable lock_option on each new query. sql/sql_lex.h: * Introduced new member variable 'lock_option' which is keeping track of the syntactical lock option of a (sub-)select query. sql/sql_parse.cc: * Wrote comments to functions. sql/sql_yacc.yy: * Introduced an attribute to keep track of syntactical lock options in sub-selects. * Made sure that the default value TL_READ_DEFAULT is at the begining of each subselect-rule. --- sql/sql_parse.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f7d6d5bac4d..f7e895d150f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5580,6 +5580,14 @@ void mysql_reset_thd_for_next_command(THD *thd) } +/** + Resets the lex->current_select object. + @note It is assumed that lex->current_select != NULL + + This function is a wrapper around select_lex->init_select() with an added + check for the special situation when using INTO OUTFILE and LOAD DATA. +*/ + void mysql_init_select(LEX *lex) { @@ -5594,6 +5602,18 @@ mysql_init_select(LEX *lex) } +/** + Used to allocate a new SELECT_LEX object on the current thd mem_root and + link it into the relevant lists. + + This function is always followed by mysql_init_select. + + @see mysql_init_select + + @retval TRUE An error occurred + @retval FALSE The new SELECT_LEX was successfully allocated. +*/ + bool mysql_new_select(LEX *lex, bool move_down) { @@ -6411,7 +6431,6 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type) DBUG_ENTER("set_lock_for_tables"); DBUG_PRINT("enter", ("lock_type: %d for_update: %d", lock_type, for_update)); - for (TABLE_LIST *tables= (TABLE_LIST*) table_list.first; tables; tables= tables->next_local) -- cgit v1.2.1