1. 10 Oct, 2006 1 commit
    • unknown's avatar
      Bug#19111: TRIGGERs selecting from a VIEW on the firing base table fail. · b9997db6
      unknown authored
      In a trigger or a function used in a statement it is possible to do
      SELECT from a table being modified by the statement.  However,
      encapsulation of such SELECT into a view and selecting from a view
      instead of direct SELECT was not possible.
      
      This happened because tables used by views (which in their turn
      were used from functions/triggers) were not excluded from checks
      in unique_table() routine as it happens for the rest of tables
      added to the statement table list for prelocking.
      
      With this fix we ignore all such tables in unique_table(), thus
      providing consistency: inside a trigger or a functions SELECT from
      a view may be used where plain SELECT is allowed.  Modification of
      the same table from function or trigger is still disallowed.  Also,
      this patch doesn't affect the case where SELECT from the table being
      modified is done outside of function of trigger, such SELECTs are
      still disallowed (this limitation and visibility problem when function
      select from a table being modified are subjects of bug 21326).  See
      also bug 22427.
      
      
      mysql-test/r/view.result:
        Add result for bug#19111: TRIGGERs selecting from a VIEW on the
        firing base table fail.
      mysql-test/t/view.test:
        Add test case for bug#19111: TRIGGERs selecting from a VIEW on the
        firing base table fail.
      sql/sql_base.cc:
        In unique_table() do not check tables that are used in a stored
        function or a trigger ('prelocking_placeholder' is set).  If such
        function or a trigger will attempt to modify a table, the error will
        be given, however select is allowed there.
      b9997db6
  2. 24 Jul, 2006 3 commits
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 3ee35057
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug14702
      
      3ee35057
    • unknown's avatar
      BUG#14702: misleading error message when syntax error in · 0233735d
      unknown authored
                 CREATE PROCEDURE
      
      The bug was fixed already.  This changeset adds a test case.
      
      
      mysql-test/r/sp-error.result:
        Add result for bug#14702: misleading error message when syntax error
        in CREATE PROCEDURE.
      mysql-test/t/sp-error.test:
        Add test case for bug#14702: misleading error message when syntax error
        in CREATE PROCEDURE.
      0233735d
    • unknown's avatar
      A fix and a test case for Bug#15752 "Lost connection to MySQL server · 39bbd1e0
      unknown authored
      when calling a SP from C API"
      
      The bug was caused by lack of checks for misuse in mysql_real_query. 
      A stored procedure always returns at least one result, which is the 
      status of execution of the procedure itself.
      This result, or so-called OK packet, is similar to a result
      returned by INSERT/UPDATE/CREATE operations: it contains the overall
      status of execution, the number of affected rows and the number of
      warnings. The client test program attached to the bug did not read this 
      result and ivnoked the next query. In turn, libmysql had no check for 
      such scenario and mysql_real_query was simply trying to send that query 
      without reading the pending response, thus messing up the communication
      protocol.
      
      The fix is to return an error from mysql_real_query when it's called
      prior to retrieval of all pending results.
      
      
      client/mysqlbinlog.cc:
        net_safe_read -> cli_safe_read
      include/mysql.h:
        Remove a private function from the public header.
      include/mysql_com.h:
        Remove a define that is never used.
      include/sql_common.h:
        Add a declaration for cli_safe_read - a function that reads one packet
        from the server.
      libmysql/libmysql.c:
        net_safe_read -> cli_safe_read
        Return CR_COMMANDS_OUT_OF_SYNC on attempt to execute a statement
        using a connection which has pending result sets.
      sql-common/client.c:
        Actual fix for Bug#15752: if the server has pending result sets for
        the client, return CR_COMMANDS_OUT_OF_SYNC on attempt to execute
        another query. Similarly to the behaviour of mysql_use_result(),
        multiple result sets block the connection and must be fetched
        before it can be used for another query.
        This uncovered an error in the protocol: the server doesn't drop
        SERVER_MORE_RESULTS_EXISTS status flag upon an error, so in case of
        a multi-query like SELECT 1; SELECT syntax_error; SELECT 2; 
        the client has no way to know that the server won't ever come to 
        execution of the third query and won't return any result sets for it.
        For now, fix it in cli_safe_read, as a proper fix requires extension
        of the client-server protocol.
      sql/protocol.cc:
        Remove a name that is never used.
      sql/slave.cc:
        net_safe_read -> cli_safe_read
      tests/mysql_client_test.c:
        Make 'query' a local variable to avoid name clash.
        Add a test case for Bug#15752 "Lost connection to MySQL server when
        calling an SP from C API"
      39bbd1e0
  3. 21 Jul, 2006 1 commit
  4. 20 Jul, 2006 1 commit
    • unknown's avatar
      Fix for BUG#20716: SHOW INSTANCES statement causes races in IM tests. · e68cbdf1
      unknown authored
        
      Fix for the bug in mysql-test-run.pl which prevents other tests succeed
      after IM-test failure.
        
      The idea of the fix of BUG#20716 is to:
        1. Check each SHOW INSTANCES statement, add necessary "sleep" instruction before;
        2. Move all environment checkings into the one file and include it everywhere.
      
      
      mysql-test/mysql-test-run.pl:
        Fix bug in mysql-test-run.pl -- kill leftovers if some
        guarded mysqld-instance is still alive after IM shutdown.
      mysql-test/r/im_daemon_life_cycle.result:
        Updated result file.
      mysql-test/r/im_life_cycle.result:
        Updated result file.
      mysql-test/r/im_options_set.result:
        Updated result file.
      mysql-test/r/im_options_unset.result:
        Updated result file.
      mysql-test/r/im_utils.result:
        Updated result file.
      mysql-test/t/im_daemon_life_cycle.imtest:
        Include im_check_env.inc for the checking of environment.
      mysql-test/t/im_life_cycle.imtest:
        Include im_check_env.inc for the checking of environment.
      mysql-test/t/im_options_set.imtest:
        Include im_check_env.inc for the checking of environment.
      mysql-test/t/im_options_unset.imtest:
        Include im_check_env.inc for the checking of environment.
      mysql-test/t/im_utils.imtest:
        Include im_check_env.inc for the checking of environment.
      mysql-test/include/im_check_env.inc:
        A new file to be included in each IM-test.
        The statements in the file ensure that starting
        conditions (environment) are as expected.
      e68cbdf1
  5. 17 Jul, 2006 2 commits
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 52a5e29f
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21013
      
      52a5e29f
    • unknown's avatar
      Bug#21013: Performance Degrades when importing data that uses Trigger · 35b165f8
      unknown authored
                 and Stored Procedure
      
      The essence of the bug was that for every re-execution of stored
      routine or prepared statement new items for character set conversions
      were created, thus increasing the number of items and the time of their
      processing, and creating memory leak.
      
      No test case is provided since current test suite can't cover such type
      of bugs.
      
      
      mysql-test/r/sp.result:
        Add result for bug#21013: Performance Degrades when importing data
        that uses Trigger and Stored Procedure.
      mysql-test/t/sp.test:
        Add test case for bug#21013: Performance Degrades when importing data
        that uses Trigger and Stored Procedure.
      sql/item.cc:
        Switch arena only when in statement prepare mode.  Subsequent executions
        will use cached item tree.
      35b165f8
  6. 13 Jul, 2006 2 commits
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · ae52219a
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug18630
      
      
      sql/item_func.cc:
        Auto merged
      sql/item_func.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_trigger.cc:
        Auto merged
      ae52219a
    • unknown's avatar
      Bug#18630: Arguments of suid routine calculated in wrong security · cd05976d
      unknown authored
                 context.
      
      Routine arguments were evaluated in the security context of the routine
      itself, not in the caller's context.
      
      The bug is fixed the following way:
      
        - Item_func_sp::find_and_check_access() has been split into two
          functions: Item_func_sp::find_and_check_access() itself only
          finds the function and check that the caller have EXECUTE privilege
          on it.  New function set_routine_security_ctx() changes security
          context for SUID routines and checks that definer have EXECUTE
          privilege too.
      
        - new function sp_head::execute_trigger() is called from
          Table_triggers_list::process_triggers() instead of
          sp_head::execute_function(), and is effectively just as the
          sp_head::execute_function() is, with all non-trigger related code
          removed, and added trigger-specific security context switch.
      
        - call to Item_func_sp::find_and_check_access() stays outside
          of sp_head::execute_function(), and there is a code in
          sql_parse.cc before the call to sp_head::execute_procedure() that
          checks that the caller have EXECUTE privilege, but both
          sp_head::execute_function() and sp_head::execute_procedure() call
          set_routine_security_ctx() after evaluating their parameters,
          and restore the context after the body is executed.
      
      
      mysql-test/r/sp-security.result:
        Add test case for bug#18630: Arguments of suid routine calculated
        in wrong security context.
      mysql-test/t/sp-security.test:
        Add result for bug#18630: Arguments of suid routine calculated
        in wrong security context.
      sql/item_func.cc:
        Do not change security context before executing the function, as it
        will be changed after argument evaluation.
        Do not change security context in Item_func_sp::find_and_check_access().
      sql/item_func.h:
        Change prototype for Item_func_sp::find_and_check_access().
      sql/sp_head.cc:
        Add set_routine_security_ctx() function.
        Add sp_head::execute_trigger() method.
        Change security context in sp_head::execute_trigger(), and in
        sp_head::execute_function() and sp_head::execute_procedure()
        after argument evaluation.
        Move pop_all_cursors() call to sp_head::execute().
      sql/sp_head.h:
        Add declaration for sp_head::execute_trigger() and
        set_routine_security_ctx().
      sql/sql_parse.cc:
        Do not change security context before executing the procedure, as it
        will be changed after argument evaluation.
      sql/sql_trigger.cc:
        Call new sp_head::execute_trigger() instead of
        sp_head::execute_function(), which is responsible to switch
        security context.
      cd05976d
  7. 12 Jul, 2006 3 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · f2a2f705
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime
      
      f2a2f705
    • unknown's avatar
      Fix a valgrind warning in type_date test. · b3180c89
      unknown authored
      
      sql/item_timefunc.cc:
        Fix a valgrind warning in type_date test.	
      b3180c89
    • unknown's avatar
      Merge dl145k.mysql.com:/data0/mkindahl/bkroot/mysql-5.0 · 4136cfc3
      unknown authored
      into  dl145k.mysql.com:/data0/mkindahl/bk/mysql-5.0-rpl
      
      
      ndb/include/kernel/GlobalSignalNumbers.h:
        Auto merged
      ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
        Auto merged
      ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
        Auto merged
      ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        Auto merged
      ndb/src/ndbapi/ndberror.c:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/handler.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      sql/sql_insert.cc:
        Auto merged
      4136cfc3
  8. 11 Jul, 2006 8 commits
    • unknown's avatar
      Post-merge fixes for Bug#19399 "Stored Procedures 'Lost Connection' · 098c8e3f
      unknown authored
      when dropping/creating tables"
      
      
      mysql-test/r/ps.result:
        A post-merge fix.
      mysql-test/t/ps.test:
        A post-merge fix: all 5.0 tests should go after 4.1 tests.
      sql/sql_lex.cc:
        auxilliary -> auxiliary
      sql/sql_prepare.cc:
        auxilliary -> auxiliary
      sql/table.cc:
        Update st_table_list::reinit_before_use in 5.0 to include 5.0-specific
        cleanups.
      sql/table.h:
        st_table_list::reinit_before_use is public.
      098c8e3f
    • unknown's avatar
      Merge bodhi.local:/opt/local/work/tmp_merge · 334ac790
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge-41
      
      
      ndb/src/mgmsrv/ConfigInfo.cpp:
        Auto merged
      sql/table.cc:
        Auto merged
      mysql-test/r/ps.result:
        Manual merge: use local.
      mysql-test/t/ps.test:
        Manual merge: remove duplicate test cases from ps.test.
      sql/sql_lex.cc:
        Manual merge.
      sql/sql_prepare.cc:
        Manual merge.
      sql/table.h:
        Manual merge.
      334ac790
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 9a06032b
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge-41
      
      
      sql/sql_table.cc:
        Auto merged
      9a06032b
    • unknown's avatar
      Merge chilla.local:/home/mydev/mysql-5.0-release · edbc99d9
      unknown authored
      into  chilla.local:/home/mydev/mysql-5.0-amerge
      
      
      sql/handler.h:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      edbc99d9
    • unknown's avatar
      Raise the version number. · 3d5d9e0b
      unknown authored
      3d5d9e0b
    • unknown's avatar
      Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.0 · cf7a380b
      unknown authored
      into  trift2.:/M50/mysql-5.0
      
      cf7a380b
    • unknown's avatar
      Merge dl145k.mysql.com:/data0/mkindahl/bkroot/mysql-5.0-rpl · 94342039
      unknown authored
      into  dl145k.mysql.com:/data0/mkindahl/bk/MERGE/mysql-5.0-merge
      
      
      ndb/include/kernel/GlobalSignalNumbers.h:
        Auto merged
      ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
        Auto merged
      ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
        Auto merged
      ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        Auto merged
      ndb/src/ndbapi/ndberror.c:
        Auto merged
      94342039
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 0bb02ba4
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge-41
      
      
      sql/opt_range.cc:
        Auto merged
      support-files/mysql.spec.sh:
        Auto merged
      mysql-test/Makefile.am:
        Manual merge.
      0bb02ba4
  9. 10 Jul, 2006 19 commits