1. 01 Nov, 2007 12 commits
    • unknown's avatar
      Merge endora.local:/Users/davi/mysql/bugs/30882-5.1 · fe683443
      unknown authored
      into  endora.local:/Users/davi/mysql/mysql-5.1-runtime
      
      
      sql/sql_parse.cc:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      fe683443
    • unknown's avatar
      Merge endora.local:/Users/davi/mysql/bugs/31850-5.1 · 0e675d81
      unknown authored
      into  endora.local:/Users/davi/mysql/mysql-5.1-runtime
      
      
      sql/sql_connect.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      0e675d81
    • unknown's avatar
      Bug#30882 Dropping a temporary table inside a stored function may cause a server crash · 611dbd0b
      unknown authored
      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.
      611dbd0b
    • unknown's avatar
      Bug#31850 Test crashes in "embedded" server · 8f0df2ef
      unknown authored
      The mysql_change_user command fails to properly update the database pointer
      when no database is selected, leading to "use after free" errors. The same
      happens on the user privilege pointer in the thread security context.
      
      The solution is to properly reset and update the database name. Also update
      the user_priv pointer so that it doesn't point to freed memory.
      
      
      sql/sql_connect.cc:
        After a successful call to check_user() without specifying a new
        database name, the previous database thd->db) is freed but the
        pointer is not updated to NULL.
      sql/sql_parse.cc:
        Update the security_ctx->priv_user pointer as it is a alias for
        the user security_ctx->user pointer. Also remove unneeded cast,
        the x_free macro casts the argument.
      8f0df2ef
    • unknown's avatar
      Cleanup execute_ddl_log_recovery() to not generate an error if · 6dd04c22
      unknown authored
      there is nothing to recover.
      
      Discovered while working on Bug#12713
      
      
      sql/sql_table.cc:
        Use MYF(0) in my_open() in read_ddl_log_header() called from
        execute_ddl_log_recovery() called during the server start up to not
        generate an error if no ddl log exists. This is not an erroneous situation,
        in fact it's the case in any server statrtup. The error was lost
        anyway, since it was pushed into the stack of the artificial thd.
      6dd04c22
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · e70f6a90
      unknown authored
      into  bodhi.(none):/opt/local/work/mysql-5.1-net_end
      
      
      e70f6a90
    • unknown's avatar
      Use Internal_error_handler mechanism to silence ER_TOO_MANY_FIELDS · 3536c5d5
      unknown authored
      error in mysql_create_frm instead of
      direct access to my_error() members.
      
      This is a pre-requisite for the patch for Bug#12713.
      
      
      sql/unireg.cc:
        Use Internal_error_handler mechanism to silence ER_TOO_MANY_FIELDS
        error in mysql_create_frm instead of
        direct access to my_error() members.
      3536c5d5
    • unknown's avatar
      Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 8c3a08e4
      unknown authored
      into  lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge
      
      
      8c3a08e4
    • unknown's avatar
      Use thd->is_error() instead of direct access to thd->net.report_error · ecef8379
      unknown authored
      in evaluate_join_record().
      
      A minor cleanup required for the fix for Bug#12713.
      
      
      sql/sql_select.cc:
        Use thd->is_error() instead of direct access to thd->net.report_error
        in evaluate_join_record()
      ecef8379
    • unknown's avatar
      Fix a compilation warning. · fbf75e0d
      unknown authored
      
      sql/sql_connect.cc:
        Fix a compilation warning (unused variable).
      fbf75e0d
    • unknown's avatar
      Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-base · cf8275e0
      unknown authored
      into  lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge
      
      
      sql/item_func.cc:
        Auto merged
      cf8275e0
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · ad723cd5
      unknown authored
      into  bodhi.(none):/opt/local/work/mysql-5.1-runtime-inc-2
      
      
      sql/sql_parse.cc:
        Auto merged
      ad723cd5
  2. 31 Oct, 2007 19 commits
    • unknown's avatar
      16bf418d
    • unknown's avatar
      A fix for Bug#32007 select udf_function() doesn't return an error if error · 189ec0e0
      unknown authored
      during udf initialization. The bug is spotted while working on Bug 12713.
      
      If a user-defined function was used in a SELECT statement, and an
      error would occur during UDF initialization, this error would not terminate
      execution of the SELECT, but rather would be converted to a warning.
      
      The fix is to use a stack buffer to store the message from udf_init instead
      of private my_error() buffer.
      
      
      mysql-test/r/udf.result:
        Update the result to reflect the fix for Bug#32007 select udf_function() 
        doesn't return an error if error during udf initialization
      mysql-test/t/udf.test:
        Update the test to reflect the fix for Bug #32007 select udf_function() 
        doesn't return an error if error during udf initialization
      sql/item_func.cc:
        A fix for Bug#32007.
        
        net.last_error buffer was used to store the temporary message from udf_init.
        Then, when my_error() was called, net.last_error was not empty so 
        my_error() would conclude that there is already an error in the error stack, 
        and not "overwrite" it.
        However, thd->net.report_error was not set, so the the 
        SELECT was not aborted.
        
        The fix is to use a stack buffer instead of thd->net.last_error
        to store the message from udf_init. The message will end up in
        thd->net.last_error anyway after a call to my_error.
      189ec0e0
    • unknown's avatar
      Remove net_printf_error(). Do not talk to network directly in · bfae4730
      unknown authored
      check_user()/check_connection()/check_for_max_user_connections().
      
      This is a pre-requisite patch for the fix for Bug#12713 "Error in a stored 
      function called from a SELECT doesn't cause ROLLBACK of statem"
      
      Implement review comments.
      
      
      sql/mysql_priv.h:
        check_for_max_user_connections() is used in one place only, make it static.
      sql/mysqld.cc:
        Remove net_printf_error(): a consolidation of error reporting facilities
        is necessary to simplify maintenance of the query cache, the 
        client-server protocol, stored procedure continue handlers. 
        Rewrite the only place where its use is somewhat justified 
        (my_error() can not be used since we need to report an error for the thread 
        that does not exist) with my_snprintf()/net_send_error().
      sql/protocol.cc:
        Remove net_printf_error().
      sql/protocol.h:
        Remove net_printf_error().
      sql/sql_connect.cc:
        Remove net_printf_error(). In check_connection()/check_user()/
        check_for_max_user_connections() do not write directly to the network,
        but use the standard my_error() mechanism to record an error in THD.
        It will be sent to the client by the caller. This was the last place
        in the server that would attempt to send an error directly, mainly left 
        untouched by 5.0 refactoring because it is executed only during 
        thread startup.
      sql/sql_parse.cc:
        In the old code, when res was greater than 0, it contained an exact 
        error code, e.g. ER_OUT_OF_RESOURCES or NO SUCH DATABASE, 
        or ER_HANDSHAKE_ERROR. I don't know the reason why this error code was 
        ignored, and instead a generic  ER_UNKNOWN_COM_ERROR was pushed into the
        error stack, but knowing the relaxed attitude towards preserving the error
        codes in the old code, I'm inclinded to think that it was a bug.
        
        After this patch, the most specific error message is already pushed,
        so calling my_message() again is useless.
        
        If res is < 0, the error used to be already sent. This is not done
        by the new code, but will be done later, in the end
        of dispatch_command(). When this is done, clear_error() will be called 
        for us - it is in the first lines of do_command.
        
        To sum up, this change is to remove COM_CHANGE_USER specific error handling
        in favor of the standard one employed for all other COM_* commands.
      bfae4730
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · c2dadab1
      unknown authored
      into  bodhi.(none):/opt/local/work/mysql-5.1-runtime-inc
      
      
      c2dadab1
    • unknown's avatar
      Try to fix a Windows compilation warning. · d757ae80
      unknown authored
      
      sql-common/client.c:
        Move a block of auxiliary functions to the beginning of the file,
        to avoid compilation warnings on Windows.
        Add comments, albeit trivial, while we're at it.
      d757ae80
    • unknown's avatar
      Merge endora.local:/Users/davi/mysql/bugs/31669-5.1 · 17d22305
      unknown authored
      into  endora.local:/Users/davi/mysql/mysql-5.1-runtime
      
      
      17d22305
    • unknown's avatar
      Post merge fix for bug 31669. · 10ed5ae7
      unknown authored
      
      tests/mysql_client_test.c:
        Macro name changed in 5.1
      10ed5ae7
    • unknown's avatar
      Cleanup: rename select_send::status to select_send::is_result_set_started. · 9ad4366b
      unknown authored
      Add select_send::cleanup.
      Fix a compilation warning.
      Issues spotted while working on the fix for Bug#12713.
      
      
      sql-common/client.c:
        Fix a warning.
      sql/sql_class.cc:
        Give a variable a more specific name. Rewrite an incorrect comment.
        Add a cleanup for select_send. The only case now this cleanup can be
        necessary is when we have a prepared statement inside a stored procedure, 
        and a continue handler. At first execution, the statement is killed
        after having executed select_send::send_fields. At the second execution
        it is killed after having executed select_send::send_fields.
      sql/sql_class.h:
        Rename a member. Add comments.
      9ad4366b
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 6c763974
      unknown authored
      into  bodhi.(none):/opt/local/work/mysql-5.1-runtime-inc
      
      
      libmysql/libmysql.c:
        Auto merged
      6c763974
    • unknown's avatar
      Cleanup: use helper functions to set an error in MYSQL or MYSQL_STMT. · 70987ab9
      unknown authored
      No functionality added or changed.
      This is a pre-requisite for the fix for Bug#12713 Error in a stored 
      function called from a SELECT doesn't cause ROLLBACK of statem
      
      Address post-review comments.
      
      
      include/sql_common.h:
        Declare auxiliary functions to manipulate mysql.net.last_er* and 
        mysql_stmt.last_er*
      libmysql/libmysql.c:
        Use helper functions to set an error in MYSQL or MYSQL_STMT
      libmysqld/lib_sql.cc:
        Use helper functions to set an error in MYSQL or MYSQL_STMT
      sql-common/client.c:
        Use helper functions to set an error in MYSQL or MYSQL_STMT
      70987ab9
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 44068505
      unknown authored
      into  station.:/mnt/raid/alik/MySQL/devel/5.1-rt-bug31649
      
      
      44068505
    • unknown's avatar
      Merge adventure.(none):/home/thek/Development/cpp/bug31347/my51-bug31347 · ce55bb75
      unknown authored
      into  adventure.(none):/home/thek/Development/cpp/mysql-5.1-runtime
      
      
      sql/sql_acl.cc:
        Auto merged
      ce55bb75
    • unknown's avatar
      Merge adventure.(none):/home/thek/Development/cpp/bug31347/my50-bug31347 · 61c6024c
      unknown authored
      into  adventure.(none):/home/thek/Development/cpp/bug31347/my51-bug31347
      
      
      sql/sql_acl.cc:
        Auto merged
      61c6024c
    • unknown's avatar
      Bug#31347 Increase in memory usage after many DROP USER statements · 8d69dd39
      unknown authored
      Dropping users causes huge increase in memory usage because field values were
      allocated on the server memory root for temporary usage but never deallocated.
      
      This patch changes the target memory root to be that of the thread handler
      instead since this root is cleared between each statement.
      
      
      sql/sql_acl.cc:
        Changed memory root from server life time memory to thread life time memory.
      8d69dd39
    • unknown's avatar
      Merge mysql.com:/home/kent/bk/bug24809/mysql-5.0-build · 41c2a2c4
      unknown authored
      into  mysql.com:/home/kent/bk/bug24809/mysql-5.1-build
      
      
      cmd-line-utils/libedit/Makefile.am:
        Auto merged
      41c2a2c4
    • unknown's avatar
      Fix for a BUG#31649: events.test fails: NULL "state" field of · 47d17e5d
      unknown authored
      SHOW PROCESSLIST.
      
      The problem was a race condition: if the Event Scheduler was not
      quick enough, the following scenario happens:
        - The Event Scheduler picks up the created event;
        - The event is executed;
        - event_scheduler_thread->proc_info is set to NULL;
        - The client issues SELECT FROM I_S.
      
      The fix is to wait for the Event Scheduler to reach 'Waiting
      for next activation' state. 
      
      
      mysql-test/t/events.test:
        Wait for the Event Scheduler to start waiting for the activation.
      47d17e5d
    • unknown's avatar
      Fix result files after patch for BUG#31035. · 77c8c76f
      unknown authored
      
      mysql-test/r/group_min_max.result:
        Update result file.
      mysql-test/r/index_merge_myisam.result:
        Update result file.
      77c8c76f
    • unknown's avatar
      Merge endora.local:/Users/davi/mysql/bugs/31669-5.1 · be4ea151
      unknown authored
      into  endora.local:/Users/davi/mysql/mysql-5.1-runtime
      
      
      be4ea151
    • unknown's avatar
      Merge endora.local:/Users/davi/mysql/mysql-5.0-runtime · 41974cf1
      unknown authored
      into  endora.local:/Users/davi/mysql/bugs/31669-5.1
      
      
      sql/sql_table.cc:
        Auto merged
      libmysql/libmysql.c:
        Manual merge
      tests/mysql_client_test.c:
        Manual merge
      41974cf1
  3. 30 Oct, 2007 9 commits
    • unknown's avatar
      Merge endora.local:/Users/davi/mysql/bugs/30904-5.1 · d2a1fe14
      unknown authored
      into  endora.local:/Users/davi/mysql/mysql-5.1-runtime
      
      
      d2a1fe14
    • unknown's avatar
      Bug#30904 SET PASSWORD statement is non-transactional · bf18f6d4
      unknown authored
      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.
      bf18f6d4
    • unknown's avatar
      Makefile.am: · 1de7e5c0
      unknown authored
        Ensure use of libedit "config.h" by adding "-I. -I$(srcdir)" to DEFS,
        work around for problem with automake 1.10 (bug#24809)
      
      
      cmd-line-utils/libedit/Makefile.am:
        Ensure use of libedit "config.h" by adding "-I. -I$(srcdir)" to DEFS,
        work around for problem with automake 1.10 (bug#24809)
      1de7e5c0
    • unknown's avatar
      In ha_delete_table, use a standard mechanism to intercept the error message · 8365a74e
      unknown authored
      and convert it to a warning instead of direct manipulation with the
      thread error stack.
      Fix a bug in handler::print_erorr when a garbled message was
      printed for HA_ERR_NO_SUCH_TABLE.
      This is a pre-requisite patch for the fix for Bug#12713 Error in a stored
      function called from a SELECT doesn't cause ROLLBACK of statem
      
      
      sql/handler.cc:
        Use a standard mechanism to intercept the error message, instead
        of direct manipulation with thread error stack. 
        Fix a bug when for HA_ERR_NO_SUCH_TABLE handler::print_error() would
        print a garbled message.
      sql/log.cc:
        Extend internal error handler interface to carry the message text.
      sql/mysqld.cc:
        Extend internal error handler interface to carry the message text.
      sql/sql_base.cc:
        Extend internal error handler interface to carry the message text.
      sql/sql_class.cc:
        Extend internal error handler interface to carry the message text.
      sql/sql_class.h:
        Extend internal error handler interface to carry the message text.
      sql/sql_error.cc:
        Extend internal error handler interface to carry the message text.
      8365a74e
    • unknown's avatar
      Minor Makefile fixes: · 85ba610f
      unknown authored
      1) Add a new top level "Makefile.am" target "make embedded-test".
      
      2) Fix a syntax error (bad merge) in "netware/Makefile.am".
      
      
      Makefile.am:
        Add a new "make" target "embedded-test" so that it is easier 
        to test the "embedded server" ("libmyslqd").
        Make it "phony".
        
        Use it via a sub-make within "test-bt" to avoid code duplication.
      netware/Makefile.am:
        Cleanup: Macros "BUILT_SOURCES" and "CLEANFILES" should be defined only once.
      85ba610f
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime · 1430f4de
      unknown authored
      into  bodhi.(none):/opt/local/work/mysql-5.1-runtime-inc-2
      
      
      sql/sql_connect.cc:
        Manual merge.
      1430f4de
    • unknown's avatar
      Use an inline getter method (thd->is_error()) to query if there is an error · 24370012
      unknown authored
      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.
      
      
      sql/filesort.cc:
        net.report_error -> is_error()
      sql/ha_ndbcluster_binlog.cc:
        net.report_error -> is_error()
      sql/item_func.cc:
        net.report_error -> is_error()
      sql/item_subselect.cc:
        net.report_error -> is_error()
      sql/set_var.cc:
        net.report_error -> is_error()
      sql/sp.cc:
        net.report_error -> is_error()
      sql/sp_head.cc:
        net.report_error -> is_error()
      sql/sql_base.cc:
        net.report_error -> is_error()
      sql/sql_class.cc:
        net.report_error -> is_error()
      sql/sql_class.h:
        net.report_error -> is_error()
      sql/sql_connect.cc:
        net.report_error -> is_error()
      sql/sql_delete.cc:
        net.report_error -> is_error()
      sql/sql_insert.cc:
        net.report_error -> is_error()
      sql/sql_parse.cc:
        net.report_error -> is_error()
      sql/sql_prepare.cc:
        net.report_error -> is_error()
      sql/sql_select.cc:
        net.report_error -> is_error()
      sql/sql_union.cc:
        net.report_error -> is_error()
      sql/sql_update.cc:
        net.report_error -> is_error()
      sql/sql_view.cc:
        net.report_error -> is_error()
      sql/sql_yacc.yy:
        net.report_error -> is_error()
      24370012
    • unknown's avatar
      Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build · 4123825d
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
      
      
      4123825d
    • unknown's avatar
      Merge dfischer@bk-internal.mysql.com:/home/bk/mysql-5.1-build · 173d8d79
      unknown authored
      into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
      
      
      mysql-test/mysql-test-run.pl:
        Auto merged
      173d8d79