An error occurred fetching the project authors.
  1. 31 Jan, 2006 2 commits
  2. 23 Jan, 2006 1 commit
  3. 19 Jan, 2006 1 commit
    • unknown's avatar
      Embedded-server related tests fixes · 6731dd63
      unknown authored
      BitKeeper/deleted/.del-ctype_cp932_notembedded.test~7c748e8e7ae6e7fe:
        Delete: mysql-test/t/ctype_cp932_notembedded.test
      mysql-test/r/innodb.result:
        result fixed
      mysql-test/r/query_cache.result:
        result fixed
      mysql-test/r/query_cache_notembedded.result:
        result fixed
      mysql-test/r/sp-error.result:
        result fixed
      mysql-test/r/sp.result:
        result fixed
      mysql-test/r/view.result:
        result fixed
      mysql-test/r/view_grant.result:
        result fixed
      mysql-test/t/sp-destruct.test:
        test disabled
      mysql-test/t/view.test:
        lines moved to view_grant.test
      mysql-test/t/view_grant.test:
        lines moved from view.test
      6731dd63
  4. 17 Jan, 2006 1 commit
    • unknown's avatar
      Bug#15206: "Misleading message "No data to FETCH": · 13f5fca9
      unknown authored
      reword the misleading message.
      
      
      mysql-test/r/sp-error.result:
        Test results fixed (Bug#15206)
      mysql-test/r/sp.result:
        Test results fixed (Bug#15206)
      mysql-test/r/type_decimal.result:
        Disable an unportable test case (Bug#7670)
      mysql-test/r/variables.result:
        Test results fixed (Bug#15206)
      mysql-test/r/view_grant.result:
        Test results fixed (Bug#15206)
      mysql-test/t/type_decimal.test:
        Remove an unportable (QNX) test case (Bug#7670). The test output
        depends on system-specific sprintf() implementation.
        The original complain was about erroneous conversion to long long,
        which was applied prior to conversion to double: but the expected
        behaviour can't be achieved until we have an own string -> double
        conversion function.
      13f5fca9
  5. 11 Jan, 2006 1 commit
    • unknown's avatar
      Fixing BUG#15658: Server crashes after creating function as empty string · 1e968057
      unknown authored
        Empty strings (and names with trailing spaces) should not be allowed.
      
      
      mysql-test/r/sp-error.result:
        New testcase for BUG#15658
      mysql-test/t/sp-error.test:
        New testcase for BUG#15658
      sql/share/errmsg.txt:
        New error message for bad stored routine names.
      sql/sp_head.cc:
        Added function for checking SP names. (Mustn't be empty or contain trailing spaces.)
      sql/sp_head.h:
        Added function for checking SP names.
      sql/sql_yacc.yy:
        Check db and name for stored routines.
      1e968057
  6. 07 Dec, 2005 2 commits
    • unknown's avatar
      Fixed sp-error.test result after merging fix for bug #11555 "Stored procedures: · 83142adf
      unknown authored
      current SP tables locking make impossible view security" with main tree.
      
      
      mysql-test/r/sp-error.result:
        Fixed test result after merging fix for bug #11555 "Stored procedures: current
        SP tables locking make impossible view security" with main tree.
      83142adf
    • unknown's avatar
      Fix for bug #11555 "Stored procedures: current SP tables locking make · 361977c0
      unknown authored
      impossible view security".
      
      We should not expose names of tables which are explicitly or implicitly (via
      routine or trigger) used by view even if we find that they are missing.
      So during building of list of prelocked tables for statement we track which
      routines (and therefore tables for these routines) are used from views. We
      mark elements of LEX::routines set which correspond to routines used in views
      by setting Sroutine_hash_entry::belong_to_view member to point to TABLE_LIST
      object for topmost view which uses routine. We propagate this mark to all
      routines which are used by this routine and which we add to this set. We also
      mark tables used by such routine which we add to the list of tables for
      prelocking as belonging to this view.
      
      
      mysql-test/r/sp-error.result:
        Added test for bug #11555 "Stored procedures: current SP tables locking make 
        impossible view security".
      mysql-test/r/view.result:
        We should not expose tables which are expicitly/implicitly used in view in
        check table statement.
      mysql-test/t/sp-error.test:
        Added test for bug #11555 "Stored procedures: current SP tables locking make 
        impossible view security".
      mysql-test/t/view.test:
        Removed comment obsoleted by bugfix.
      sql/sp.cc:
        We should not expose names of tables which are explicitly or implicitly
        (via routine or trigger) used by view even if we find that they are missing.
        So during building of list of prelocked tables for statement we track which
        routines (and therefore tables for these routines) are used from views. We
        mark elements of LEX::routines set which correspond to routines used in views
        by setting Sroutine_hash_entry::belong_to_view member to point to TABLE_LIST
        object for topmost view which uses routine. We propagate this mark to all
        routines which are used by this routine and which we add to this set. We also
        mark tables used by such routine which we add to the list of tables for
        prelocking as belonging to this view.
      sql/sp.h:
        sp_cache_routines_and_add_tables_for_view()/for_triggers():
          To be able to determine correctly uppermost view which uses this view/table
          with trigger we have to pass pointer to TABLE_LIST object instead of pointer
          to view's LEX or to Table_triggers_list object.
      sql/sp_head.cc:
        sp_head::add_used_tables_to_table_list():
          Added new argument which allows to mark tables which are added to table
          list for prelocking as belonging to view (this allows properly hide names
          of tables which are used in routines used by views).
      sql/sp_head.h:
        sp_head::add_used_tables_to_table_list():
          Added new argument which allows to mark tables which are added to table
          list for prelocking as belonging to view (this allows properly hide names
          of tables which are used in routines used by views).
      sql/sql_base.cc:
        open_tables():
          sp_cache_routines_and_add_tables_for_view()/for_triggers() now accept
          pointer to table list element as last argument, this allows them to determine
          correctly uppermost view which uses this view/table with trigger.
      sql/sql_trigger.h:
        Table_triggers_list:
          sp_cache_routines_and_add_tables_for_triggers() now accept pointer to table
          list element as last argument, this allows to determine correctly uppermost
          view which uses this table with trigger.
      361977c0
  7. 03 Dec, 2005 1 commit
    • unknown's avatar
      this has nothing to do with the bug#13012. · da8b9967
      unknown authored
      it's about mysql_admin_commands not being reexecution-safe
      (and CHECK still isn't)
      
      
      mysql-test/r/sp-error.result:
        optimize is now allowed in SP
      mysql-test/r/sp.result:
        test repair/optimize/analyze in SP
      mysql-test/t/backup.test:
        clean up after itself
      mysql-test/t/sp-error.test:
        optimize is now allowed in SP
      mysql-test/t/sp.test:
        test repair/optimize/analyze in SP
      sql/sp_head.cc:
        all mysql_admin commands return result set
      sql/sql_parse.cc:
        all mysql_admin commands modify table list and we should restore it for SP
      sql/sql_table.cc:
        optimization - don't execute views when no view is expected/allowed
      sql/sql_yacc.yy:
        optimize is now allowed in SP
      da8b9967
  8. 02 Dec, 2005 1 commit
  9. 25 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14233: Crash after tampering with the mysql.proc table · d4088df5
      unknown authored
        Post-review version. Some minor review fixes, but also changed the way
        some errors are handled: Don't return specific parse errors; instead
        always use the more general "table corrupt" error (amended accordingly).
      
      
      mysql-test/r/sp-destruct.result:
        Updated results.
      mysql-test/r/sp-error.result:
        Updated for fully qualified name in "no return" error message.
      mysql-test/t/sp-destruct.test:
        Adopted the more consistent error handling for a corrupted mysql.proc table.
        (No more "parse error" et al).
      sql/share/errmsg.txt:
        Changed ER_SP_PROC_TABLE_CORRUPT to be more explicit.
      sql/sp.cc:
        Review fixes.
        Changed the handling of parse errors, and added the routine name to the "table corrupt" error message.
      sql/sql_base.cc:
        Review changes: Change error tests and added comments.
      sql/sql_parse.cc:
        Mored ER_SP_NORETURN test of functions to sql_yacc.yy for more general error handling.
      sql/sql_yacc.yy:
        Mored ER_SP_NORETURN test of functions from sql_parse.cc for more general error handling.
      d4088df5
  10. 22 Nov, 2005 1 commit
    • unknown's avatar
      Recursion support made for SP (BUG#10100). · 164ce4c5
      unknown authored
      client/mysqltest.c:
        An expected error messages hiding from the log if disable_result_log is in force.
      mysql-test/r/sp-dynamic.result:
        The test expanded for case of allowed/disalowed recursion.
      mysql-test/r/sp-error.result:
        Error messages changed.
        Test of bug11394() made with allowed recursion.
      mysql-test/r/sp.result:
        Tests for recursion.
      mysql-test/r/trigger.result:
        Check that triggers are not affected by this patch.
      mysql-test/r/variables.result:
        Test of max_sp_recursion_depth variable.
      mysql-test/t/sp-dynamic.test:
        The test expanded for case of allowed/disalowed recursion.
      mysql-test/t/sp-error.test:
        Error messages changed.
        Test of bug11394() made with allowed recursion.
      mysql-test/t/sp.test:
        Tests for recursion.
      mysql-test/t/trigger.test:
        Check that triggers are not affected by this patch.
      mysql-test/t/variables.test:
        Test of max_sp_recursion_depth variable.
      sql/item_func.cc:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
      sql/mysqld.cc:
        max_sp_recursion_depth variable added.
      sql/set_var.cc:
        max_sp_recursion_depth variable added.
      sql/share/errmsg.txt:
        An error message changed.
        An error message added.
      sql/sp.cc:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
        Temory LEX is allocated on a stack, not on a heap.
        Recursion support added for stored procedures.
      sql/sp.h:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
      sql/sp_head.cc:
        Initialization of new sp_head fields to get correct list of instances
          contained one instance only.
        Stack requirement for SP instruction is increased.
        Stack free space is checked before mem root initialisation to avoid
          memory leak.
        Pointer to the free instance management added before and after
          SP execution.
      sql/sp_head.h:
        New sp_head variables added to support inst of instances of SP
          for recursion and pointer on ths first free to use instance.
      sql/sql_base.cc:
        open_table() consume a lot of stack space so we check free stack space before it.
      sql/sql_class.h:
        max_sp_recursion_depth variable added.
      sql/sql_parse.cc:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
      164ce4c5
  11. 18 Nov, 2005 1 commit
    • unknown's avatar
      Bug#13510 "Setting password local variable changes current · 6ba79a25
      unknown authored
      password": additional fix, also make sure that a syntax error is 
      returned for set names="foo" when there is no such variable or no
      stored procedure.
      
      
      mysql-test/r/sp-error.result:
        Test results fixed: a new test for Bug#13510
      mysql-test/t/sp-error.test:
        A new test for Bug#13510 (set names out of an SP)
      sql/sql_yacc.yy:
        Bug#13510: fix the case when there is no stored procedure or
        no 'names' variable declared. Return a syntax error in this case.
      6ba79a25
  12. 17 Nov, 2005 1 commit
    • unknown's avatar
      Fix for bug #13399 Crash when executing PS/SP which should activate trigger · d518f702
      unknown authored
      which is now dropped" and bug #12329 "Bogus error msg when executing PS with
      stored procedure after SP was re-created".
      
      
      mysql-test/r/sp-error.result:
        Added test for bug #12329 "Bogus error msg when executing PS with stored
        procedure after SP was re-created".
      mysql-test/r/trigger.result:
        Added test for bug #13399 Crash when executing PS/SP which should activate
        trigger which is now dropped".
      mysql-test/t/sp-error.test:
        Added test for bug #12329 "Bogus error msg when executing PS with stored
        procedure after SP was re-created".
      mysql-test/t/trigger.test:
        Added test for bug #13399 Crash when executing PS/SP which should activate
        trigger which is now dropped".
      sql/sp_head.cc:
        sp_head::add_used_tables_to_table_list():
          We have to copy database/table names and alias to PS/SP memory since current
          instance of sp_head object can pass away before next execution of PS/SP for
          which tables are added to prelocking list.
          This will be fixed by introducing of proper invalidation mechanism once new
          TDC is ready.
      d518f702
  13. 16 Nov, 2005 1 commit
    • unknown's avatar
      Issuing error about presence of commit/rollback statements in stored functions... · 8a661e77
      unknown authored
      Issuing error about presence of commit/rollback statements in stored functions and triggers added to SP parsing procedure (BUG#13627)
      
      The crash mentioned in original bug report is already prevented by one
      of previous patches (fix for bug #13343 "CREATE|etc TRIGGER|VIEW|USER
      don't commit the transaction (inconsistency)"), this patch only improve
      error returning.
      
      
      mysql-test/r/sp-error.result:
        Test that statements which implicitly commit transaction
      mysql-test/t/sp-error.test:
        Test that statements which implicitly commit transaction
      sql/sp_head.cc:
        We set the new flag about commit/rollback statements presence
      sql/sp_head.h:
        The new flag about commit/rollback presence added
        A comment fixed
      sql/sql_yacc.yy:
        Removed commit/rollback-statement-present errors spread by this file, only one check left which check flags of a SP
      8a661e77
  14. 11 Nov, 2005 1 commit
    • unknown's avatar
      Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()... · 1c677f8c
      unknown authored
      we changing current db temporarily and restore it when sp is created. however thd->db
      in this case becomes empty string rather than NULL and so all checks of thd->db == NULL 
      will be false. So if after this we'll issue create procedure sp2()... without specifying
      db it will succeed and create sp with db=NULL, which causes mysqldto crash on 
      show procedure status statement.
      
      This patch fixes the problem.
      
      
      mysql-test/r/sp-error.result:
        Result for bug #14569.
      mysql-test/t/sp-error.test:
        Test for bug #14569.
      sql/sql_db.cc:
        Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()...
        we changing current db temporarily and restore it when sp is created. however thd->db
        in this case becomes empty string rather than NULL and so all checks of thd->db == NULL 
        will be false. This patch fixes this issue.
      sql/sql_parse.cc:
        Fixes bug #14569. Reverted from initial patch to check thd->db for null values only.
      1c677f8c
  15. 25 Oct, 2005 1 commit
    • unknown's avatar
      Fix for BUG#13037: undefined variable in IF cause erroneous error-message. · 5ed3b0b3
      unknown authored
      mysql-test/r/sp-error.result:
        Results for the test case for BUG#13037.
      mysql-test/t/sp-error.test:
        Test case for BUG#13037.
      sql/sql_base.cc:
        Polishing: use constant.
      sql/sql_class.cc:
        Reset THD::where in THD::cleanup_after_query();
        Polishing: use the constant (THD::DEFAULT_WHERE).
      sql/sql_class.h:
        Introduce a constant for the default value of THD::where.
      5ed3b0b3
  16. 19 Oct, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#13587 "Server crash when SP is created · 33c972e4
      unknown authored
      without database"
      
      
      mysql-test/r/sp-error.result:
        Test results fixed (a test case for Bug#13587)
      mysql-test/t/sp-error.test:
        A test case for Bug#13587 "Server crash when SP is created without 
        database"
      sql/sql_parse.cc:
        - move initialization of lex->sphead->m_db before it's used.
        - cleanup; comment why right now can't be cleaned any more
      33c972e4
  17. 11 Oct, 2005 1 commit
    • unknown's avatar
      Fixed BUG#13510: Setting password local variable changes current password · 71c89622
      unknown authored
        Disallow conflicting use of variables named "password" and "names". If such
        a variable is declared, and "SET ... = ..." is used for them, an error is
        returned; the user must resolve the conflict by either using `var` (indicating
        that the local variable is set) or by renaming the variable.
        This is necessary since setting "password" and "names" are treated as special
        cases by the parser.
      
      
      mysql-test/r/sp-error.result:
        New test cases for BUG#13510
      mysql-test/t/sp-error.test:
        New test cases for BUG#13510
      sql/share/errmsg.txt:
        New error message for when certain variable names are use which would be
        parsed the wrong way. (E.g. "password" and "names")
      sql/sql_yacc.yy:
        Check if "names" or "password" are used as local variable/parameter, in which
        case "set names" or "set password" will be parsed the wrong way. Give an error
        message instead.
      71c89622
  18. 21 Sep, 2005 1 commit
    • unknown's avatar
      Bug #13231 mysqltest: fails to dectect when mysql_next_result fails · d770fdce
      unknown authored
       - Added functionality to check errors returned from mysql_next_result
       - Exit from mysqltest when and unexpected error occurs.
       - The above fixes reveal problems with rpl000009, sp-error and query_cache-
       - Fix sp-error by adding an expected error
       - Fix rpl000009 by not sending "ok" from mysql_create_db when called with silent flag from load_master_data
       - Fix query_cache in separate patch
      
      
      client/mysqltest.c:
        Check and handle error after mysql_next_result
        Change several verbose_msg to die so that the error is properly reported
        Clean up of error handling code in run_query_stmt, check all errors and use common
        function handle_error.
      mysql-test/r/mysqltest.result:
        mysqltest now dies when a query fails with wrong errno
      mysql-test/r/sp-error.result:
        Update test result to match the expected error from calling the sp closing a cursor that is not open.
      mysql-test/t/sp-error.test:
        Add missing --error 1326 before call to sp that closes a already closed cursor.
        Add test for bug9367
      sql/sql_db.cc:
        Don't send ok in mysql_create_db if silent flag is set.
      d770fdce
  19. 13 Sep, 2005 1 commit
    • unknown's avatar
      Fixed BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers · 065a9377
      unknown authored
        Second version after review. Allow 'set autocommit' in procedures, but not
        functions or triggers. Can return error in run-time (when a function calls
        a procedure).
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#12712.
      mysql-test/t/sp-error.test:
        New test case for BUG#12712.
      sql/set_var.cc:
        Made sys_autocommit external, to allow testing in sql_yacc.yy.
      sql/set_var.h:
        Made sys_autocommit external, to allow testing in sql_yacc.yy.
      sql/share/errmsg.txt:
        New error message for disallowing the setting of autocommit in stored functions and triggers.
      sql/sp_head.h:
        New flag: has 'set autocommit', and testing for this in is_not_allowed_in_function().
      sql/sql_yacc.yy:
        Disallow setting AUTOCOMMIT in stored function and triggers.
      065a9377
  20. 07 Sep, 2005 1 commit
    • unknown's avatar
      Fix for Bug#12995: Inside function "Table 't4' was not locked with LOCK TABLES" · eb061b65
      unknown authored
      Any form of HANDLER statement is forbidden from usage in stored procedures/functions.
      
      
      mysql-test/r/sp-error.result:
        Results for the test case for Bug#12995 added.
      mysql-test/t/sp-error.test:
        Test case for Bug#12995 added.
      sql/sql_yacc.yy:
        Forbid any form of "HANDLER" statement from use in stored procedures/functions.
      eb061b65
  21. 06 Sep, 2005 1 commit
    • unknown's avatar
      Fix for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" · b8920588
      unknown authored
      OPTIMIZE TABLE statement is forbidden from usage in stored procedures/functions.
      
      NOTE: OPTIMIZE TABLE statement can be useful in stored procedures. The idea is
      that the user/administrator can create a stored procedure for admin
      tasks (optimizing, backing up, etc). This procedure can be scheduled to run
      automatically (by mean of internal cron (WL#1034)). So, once we can make this
      statement work, it is worth doing it.
      
      
      mysql-test/r/sp-error.result:
        Results for the test case for Bug#12953 added.
      mysql-test/t/sp-error.test:
        Test case for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" added.
      sql/sql_yacc.yy:
        Forbid "OPTIMIZE TABLE" statement from use in stored procedures/functions.
      b8920588
  22. 02 Sep, 2005 1 commit
    • unknown's avatar
      Implement WL#2661 "Prepared Statements: Dynamic SQL in Stored Procedures". · c910050a
      unknown authored
      The idea of the patch is to separate statement processing logic,
      such as parsing, validation of the parsed tree, execution and cleanup, 
      from global query processing logic, such as logging, resetting
      priorities of a thread, resetting stored procedure cache, resetting
      thread count of errors and warnings.
      This makes PREPARE and EXECUTE behave similarly to the rest of SQL
      statements and allows their use in stored procedures.
      This patch contains a change in behaviour:
      until recently for each SQL prepared statement command, 2 queries
      were written to the general log, e.g.
      [Query]   prepare stmt from @stmt_text;
      [Prepare] select * from t1 <-- contents of @stmt_text
      The chagne was necessary to prevent [Prepare] commands from being written
      to the general log when executing a stored procedure with Dynamic SQL.
      We should consider whether the old behavior is preferrable and probably
      restore it.
      This patch refixes Bug#7115, Bug#10975 (partially), Bug#10605 (various bugs
      in Dynamic SQL reported before it was disabled).
      
      
      mysql-test/r/not_embedded_server.result:
        Since we don't want to log Dynamic SQL in stored procedures,
        now the general log gets only one log entry per SQL statement.
      mysql-test/r/sp-error.result:
        - remove obsolete tests
        - a better error message for the case when a stored procedure that
        returns a result set is called from a function
      mysql-test/r/trigger.result:
        - a better error message for the case when a stored procedure that
        returns a result set is called from a trigger
      mysql-test/t/sp-error.test:
        - a better error message for the case when a stored procedure that
          returns a result set is called from a function.
        - move the comment to its place (end of file).
      mysql-test/t/trigger.test:
        - a better error message for the case when a stored procedure that
        returns a result set is called from a trigger
      sql/item_func.cc:
        - we need to pass sql_command explicitly to get_var_with_binlog, because
        when creating a query for SQL prepared statement thd->lex->sql_command
        points at SQLCOM_EXECUTE, which is not listed in the list of update
        queries.
      sql/log_event.h:
        - remove an extra copy of the previous sentence
      sql/mysql_priv.h:
        - fix declarations of sql_prepare.cc API
      sql/share/errmsg.txt:
        - a new error message, when one attempts to execute a prepared statement
        which is currently being executed (this can happen only in Dynamic SQL
        at the moment).
      sql/sp_head.cc:
        - extend sp_multi_results_command to return different flags for a
        command (and rename it)
        - add support for SQLCOM_PREPARE,SQLCOM_EXECUTE, SQLCOM_DEALLOCATE
          to sp_get_flags_for_command
        - replace multiple boolean sp_head members with uint m_flags
        - a fix for a crash when user variables are used in a stored procedure
          and binlog is on. A temporary fix for Bug#12637 "SP crashes the server 
         if it has update query with user var & binlog is enabled", which actually
         stands for stored functions: now instead of a crash we break
         replication if a user variable is used in a stored function which 
         is executed in prelocked mode.
      sql/sp_head.h:
        - replace multiple boolean flags of sp_head with uint m_flags;
        - add flag CONTAINS_DYNAMIC_SQL
        - use this flag to error if a stored procedure with Dynamic SQL is
          called from a function or trigger.
      sql/sql_class.cc:
        - Statement_map::insert should not delete a statement if it exists,
          now it's done externally to be able to handle the case when the
          statement being deleted is in use.
        - remove extra code (free_list is already reset in free_items)
      sql/sql_lex.cc:
        - add lex->stmt_prepare_mode; we can't rely on thd->command any more,
          because we don't reset it any more (Dynamic SQL requirement is that
          PS are as little intrusive as possible).
      sql/sql_lex.h:
        - declare bool LEX::stmt_prepare_mode
      sql/sql_parse.cc:
        - move prepared statement code to sql_prepare.cc
        - change declarations (refactored code)
        - better error message when one attempts to use Dynamic SQL or a 
          stored procedure that returns a result set in a function or trigger.
      sql/sql_prepare.cc:
        - major refactoring to ensure PREPARE/EXECUTE commands do not reset global THD
          state and allow their use in stored procedures.
        - add Prepared_statement::flags and use it to ensure no recursive execution
          of a prepared statement is possible
        - better comments
      sql/sql_yacc.yy:
        - enable PREPARE/EXECUTE/DEALLOCATE in stored procedures
        - produce an error message on attempt to use PREPARE/EXECUTE/DEALLOCATE
          in a stored function or trigger
      mysql-test/r/sp-dynamic.result:
        - sp-dynamic.test results
      mysql-test/t/sp-dynamic.test:
        - a new test for PREPARE/EXECUTE/DEALLOCATE in stored procedures.
      c910050a
  23. 29 Aug, 2005 1 commit
    • unknown's avatar
      fix for bug #12490 (all-in-one patch) · afe5507c
      unknown authored
      (Packets out of order if calling HELP CONTENTS from Stored Procedure)
      
      
      mysql-test/r/sp-error.result:
        results of test of bug 12490
      mysql-test/t/sp-error.test:
        test for bug 12490
        (Packets out of order if calling HELP CONTENTS from Stored Procedure)
      sql/sql_yacc.yy:
        disable HELP in SP
        (fixes bug 12490)
      afe5507c
  24. 18 Aug, 2005 1 commit
    • unknown's avatar
      Fix for bug #11896 "Partial locking in case of recursive trigger definitions". · b1921c85
      unknown authored
      If we are in stored function or trigger we should ensure that we won't change
      table that is already used by calling statement (this can damage table or
      easily cause infinite loops). Particularly this means that recursive triggers
      should be disallowed.
      
      
      mysql-test/r/sp-error.result:
        Added tests checking that in functions we don't allow to update tables which
        are used by statements which invoke these functions.
      mysql-test/r/trigger.result:
        Added test for bug #11896 "Partial locking in case of recursive trigger
        definitions".
      mysql-test/t/sp-error.test:
        Added tests checking that in functions we don't allow to update tables which
        are used by statements which invoke these functions.
      mysql-test/t/trigger.test:
        Added test for bug #11896 "Partial locking in case of recursive trigger
        definitions".
      sql/share/errmsg.txt:
        Added error messages for complaining about situations when in function or
        trigger we try to change table which is used in statement invoking this
        function or trigger.
      sql/sql_base.cc:
        open_table():
          If we are in stored function or trigger we should ensure that
          we won't change table that is already used by calling statement
          (this can damage table or easily cause infinite loops).
          So if we are opening table for writing, we should check that it
          is not already open by some calling stamement.
      b1921c85
  25. 10 Aug, 2005 1 commit
    • unknown's avatar
      Fix for bug #12280 "Triggers: crash if flush tables". · f6fff55e
      unknown authored
      We should not allow FLUSH statement to be executed inside both triggers
      and stored functions.
      
      
      mysql-test/r/sp-error.result:
        Updated test after replacing error, which is thrown when one uses FLUSH
        statement inside of stored function, with more specific.
        Also now we issue more general error when we barking about USE command
        in stored routines.
      mysql-test/r/trigger.result:
        Added test for bug #12280 "Triggers: crash if flush tables"
      mysql-test/t/sp-error.test:
        Updated test after replacing error, which is thrown when one uses FLUSH
        statement inside of stored function, with more specific.
        Also now we issue more general error when we barking about USE command
        in stored routines.
      mysql-test/t/trigger.test:
        Added test for bug #12280 "Triggers: crash if flush tables"
      sql/share/errmsg.txt:
        Removed ER_SP_NO_USE error. Now we use more general ER_SP_BADSTATEMENT in this
        case. Instead added error message for barking about statements which should not
        be allowed inside of stored functions or triggers.
        It is safe to do this since it is highly unprobable that someone will upgrade
        first to the new 5.0 release and then downgrade back to the old one.
      sql/sql_parse.cc:
        reload_acl_and_cache():
          FLUSH TABLES and FLUSH PRIVILEGES should not be allowed if we are inside
          of stored function or trigger.
      sql/sql_yacc.yy:
        We should not allow FLUSH statement inside both triggers and stored
        functions. Replaced error which is thrown in this case with more
        specific.
        Also now we issue more general ER_SP_BADSTATEMENT error when one tries
        to use USE command inside of stored routine.
      f6fff55e
  26. 13 Jul, 2005 1 commit
    • unknown's avatar
      Implementation of Monty's idea: Now we can open mysql.proc table for lookup · 11f9e513
      unknown authored
      of stored routines definitions even if we already have some tables open and
      locked. To avoid deadlocks in this case we have to put certain restrictions
      on locking of mysql.proc table.
      
      This allows to use stored routines safely under LOCK TABLES without explicitly
      mentioning mysql.proc in the list of locked tables. It also fixes bug #11554
      "Server crashes on statement indirectly using non-cached function".
      
      
      mysql-test/r/sp-error.result:
        Added test which checks that now we can read stored routines definitions
        under LOCK TABLES even if we have not locked mysql.proc explicitly. Also
        added check for restrictions which this ability puts on mysql.proc locking.
        Updated test for bug #9566 to correspond this new situation.
      mysql-test/r/sp-threads.result:
        Added test for bug #11554 "Server crashes on statement indirectly using
        non-cached function".
      mysql-test/t/sp-error.test:
        Added test which checks that now we can read stored routines definitions
        under LOCK TABLES even if we have not locked mysql.proc explicitly. Also
        added check for restrictions which this ability puts on mysql.proc locking.
        Updated test for bug #9566 to correspond this new situation.
      mysql-test/t/sp-threads.test:
        Added test for bug #11554 "Server crashes on statement indirectly using
        non-cached function".
      sql/lock.cc:
        get_lock_data():
         To be able to open and lock for reading system tables like 'mysql.proc',
         when we already have some tables opened and locked, and avoid deadlocks
         we have to disallow write-locking of these tables with any other tables.
      sql/mysql_priv.h:
        open_table() has new parameter which allows to open table even if some-one
        has done a flush or holding namelock on it.
      sql/share/errmsg.txt:
        Added error message saying that one cannot write-lock some of system tables
        with any other tables.
      sql/sp.cc:
        open_proc_table_for_read()/close_proc_table():
          Added functions to be able open and close mysql.proc table when we already
          have some tables open and locked.
        open_proc_table_for_update():
          Added function to simplify opening of mysql.proc for updates.
        db_find_routine_aux()/db_find_routine()/db_update_routine()/...
          Moved responsibility for opening mysql.proc table from db_find_routine_aux()
          one level up, since this level knows better which type of table access for
          reading of for update it needs.
        sp_function_exists():
          Removed unused function.
      sql/sp.h:
        sp_function_exists():
          Removed unused function.
      sql/sql_base.cc:
        open_table():
          Added new parameter which allows to open table even if some-one has done a
          flush or holding namelock on it.
        open_unireg_entry():
          Mark 'mysql.proc' as a system table which has special restrictions on its
          locking, but thanks to them can be open and locked even if we already have
          some open and locked.
      sql/sql_class.cc:
        Moved THD members holding information about open and locked tables to separate
        Open_tables_state class to be able to save/restore this state easier.
        Added THD::push_open_tables_state()/pop_open_tables_state() methods for
        saving/restoring this state.
      sql/sql_class.h:
        Moved THD members holding information about open and locked tables to separate
        Open_tables_state class to be able to save/restore this state easier.
        Added THD::push_open_tables_state()/pop_open_tables_state() methods for
        saving/restoring this state.
      sql/sql_lex.cc:
        Removed LEX::proc_table member which was not really used.
      sql/sql_lex.h:
        Removed LEX::proc_table member which was not really used.
      sql/sql_table.cc:
        open_table() has new parameter which allows to open table even if some-one
        has done a flush or holding namelock on it.
      sql/table.h:
        Added TABLE_SHARE::system_table indicating that this table is system table
        like 'mysql.proc' and we want to be able to open and read-lock it even when
        we already have some tables open and locked (and because of this we have
        to put some restrictions on write locking it).
      11f9e513
  27. 09 Jul, 2005 1 commit
    • unknown's avatar
      Enable support of access to tables from triggers. Thus fix bug #8406 "Triggers · 14b1f91b
      unknown authored
      crash if referencing a table" and several other related bugs.
      Fix for bug #11834 "Re-execution of prepared statement with dropped function
      crashes server." which was spotted during work on previous bugs.
      
      Also couple of nice cleanups:
      - Replaced two separate hashes for stored routines used by statement with one.
      - Now instead of doing one pass through all routines used in statement for
        caching them and then doing another pass for adding their tables to table
        list, we do only one pass during which do both things.
      
      
      mysql-test/r/sp-error.result:
        Added test for bug #11834 "Re-execution of prepared statement with dropped
        function crashes server" also covering handling of prepared statements
        which use stored functions but does not require prelocking.
      mysql-test/r/sp.result:
        Updated test for LOCK TABLES with views in table list.
        (Old version of statement used in this test will work ok now, since prelocking
         algorithm was tuned and will lock only one multi-set of tables for each routine
         even if this routine is used in several different views).
      mysql-test/r/trigger.result:
        Added several tests for triggers using tables.
      mysql-test/t/sp-error.test:
        Added test for bug #11834 "Re-execution of prepared statement with dropped
        function crashes server" also covering handling of prepared statements
        which use stored functions but does not require prelocking.
      mysql-test/t/sp.test:
        Updated comment about recursive views to reflect current situation.
        Updated test for LOCK TABLES with views in table list.
        (Old version of statement used in this test will work ok now, since prelocking
         algorithm was tuned and will lock only one multi-set of tables for each routine
         even if this routine is used in several different views).
      mysql-test/t/trigger.test:
        Added several tests for triggers using tables.
      sql/item_func.cc:
        Item_func_sp::cleanup():
          By next statement execution stored function can be dropped or altered so
          we can't assume that sp_head object for it will be still valid.
      sql/sp.cc:
        - Added Sroutine_hash_entry structure that represents element in the set of
          stored routines used by statement or routine. We can't as before use
          LEX_STRING for this purprose because we want link all elements of this set
          in list.
        - Replaced sp_add_to_hash() with sp_add_used_routine() which takes into account
          that now we use one hash for stored routines used by statement instead of two
          and which mantains list linking all elelemnts in this hash.
        - Renamed sp_merge_hash() to sp_update_sp_used_routines().
        - Introduced sp_update_stmt_used_routines() for adding elements to the set of
          routines used by statement from another similar set for statement or routine.
          This function will also mantain list linking elements of destination set.
        - Now instead of one sp_cache_routines() function we have family of 
          sp_cache_routines_and_add_tables() functions which are also responsible for
          adding tables used by routines being cached to statement table list. Nice
          optimization - thanks to list linking all elements in the hash of routines
          used by statement we don't need to perform several iterations over this hash
          (as it was before in cases when we have added new elements to it).
      sql/sp.h:
        Added declarations of functions used for manipulations with set (hash) of stored
        routines used by statement.
      sql/sp_head.cc:
        sp_name::init_qname():
          Now sp_name also holds key identifying routine in the set (hash) of
          stored routines used by statement. 
        sp_head:
          Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
          routines used by this routine we use one hash - m_sroutines. 
        sp_instr_set_trigger_field:
          Added support for subqueries in assignments to row accessors in triggers.
        Removed definition of sp_add_sp_tables_to_table_list() and auxilary functions 
        since now we don't have separate stage on which we add tables used by routines
        used by statement to table list for prelocking. We do it on the same stage as
        we load those routines in SP cache. So all this functionality moved to
        sp_cache_routines_and_add_tables() family of functions.
      sql/sp_head.h:
        sp_name:
          Now this class also holds key identifying routine in the set (hash) of stored
          routines used by statement. 
        sp_head:
          Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
          routines used by this routine we use one hash - m_sroutines. 
        sp_instr_set_trigger_field:
          Added support for subqueries in assignments to row accessors in triggers.
        Removed declaration of sp_add_sp_tables_to_table_list() since now we don't have
        separate stage on which we add tables used by routines used by statement to
        table list for prelocking. We do it on the same stage as we load those routines
        in SP cache.
      sql/sql_base.cc:
        open_tables():
        - LEX::spfuns/spprocs hashes were replaced with one LEX::sroutines hash.
        - Now instead of doing one pass through all routines used in statement for
          caching them and then doing another pass for adding their tables to table
          list, we do only one pass during which do both things. It is easy to do
          since all routines in the set of routines used by statement are linked in
          the list. This also allows us to calculate table list for prelocking more
          precisely.
        - Now triggers properly inform prelocking algorithm about tables they use.
      sql/sql_lex.cc:
        lex_start():
          Replaced LEX::spfuns/spprocs with with one LEX::sroutines hash.
          Added LEX::sroutines_list list linking all elements in this hash.
        st_lex::st_lex():
          Moved definition of LEX constructor to sql_lex.cc file to be able
          use sp_sroutine_key declaration from sp.h in it.
      sql/sql_lex.h:
        LEX:
          Replaced two separate hashes for stored routines used by statement with one.
          Added list linking all elements in this hash to be able to iterate through all
          elements and add new elements to this hash at the same time.
          Moved constructor definition to sql_lex.cc.
      sql/sql_parse.cc:
        mysql_execute_command():
          Replaced LEX::spfuns/spprocs with one LEX::sroutines hash.
      sql/sql_trigger.cc:
        Added missing GNU GPL notice.
        Table_triggers_list::check_n_load()
          Added initialization of sroutines_key which stores key representing
          triggers of this table in the set (hash) of routines used by this statement.
      sql/sql_trigger.h:
        Added missing GNU GPL notice.
        Table_triggers_list:
          Added sroutines_key member to store key representing triggers of this
          table in the set (hash) of routines used by this statement.
          Declared sp_cache_routines_and_add_tables_for_triggers() as friend since
          it needs access to sroutines_key and trigger bodies.
      sql/sql_yacc.yy:
        - Now we use sp_add_used_routine() instead of sp_add_to_hash() for adding
          elements to the set of stored routines used in statement.
        - Enabled support of subqueries as right sides in assignments to triggers' row
          accessors.
      14b1f91b
  28. 08 Jul, 2005 1 commit
    • unknown's avatar
      Fixed BUG#11365: Stored Procedure: Crash on Procedure operation · accdff51
      unknown authored
        Two separate problems. A key buffer was too small in sp.cc for multi-byte
        fields, and the creation and fixing of mysql.proc in the scripts hadn't been
        updated with the correct character sets and collations (like the other
        system tables had).
        Note: No special test case, as the use of utf8 for mysql.proc will make
        any existing crash (if the buffer overrrun wasn't fixed).
      
      
      mysql-test/r/sp-error.result:
        Updated test case for too long SP names (as the limit has increased with the use of utf8).
      mysql-test/t/sp-error.test:
        Updated test case for too long SP names (as the limit has increased with the use of utf8).
      scripts/mysql_create_system_tables.sh:
        Use utf8 for mysql.proc, just like for the other system tables.
      scripts/mysql_fix_privilege_tables.sql:
        Use utf8 for mysql.proc, just like for the other system tables.
        (Some tabs also replaced by space)
      sql/sp.cc:
        Use a larger key buffer for stored procedures to avoid stack overrun with multi-byte keys.
      accdff51
  29. 04 Jul, 2005 1 commit
    • unknown's avatar
      Fix for BUG#9814: Clear thd->net.no_send_error before each SP instruction · b87b3255
      unknown authored
      execution. Failure to do so caused the erroneous statements to send nothing
      and hang the client.
      
      
      mysql-test/r/sp-error.result:
        Testcase for BUG#9814. Note that the result demonstrates that currently
        mysql-test-run ignores errors in multi-statement if they arrive after first 
        resultset has been received.
      mysql-test/t/sp-error.test:
        Testcase for BUG#09814.
      b87b3255
  30. 01 Jul, 2005 2 commits
    • unknown's avatar
      Disabled the GOTO feature. (It's non-standard and undocumented.) · 1ff4a0eb
      unknown authored
      We want to have the defacto standard syntax for labels ("L:" instead of "label L;"),
      and fix some known bugs, before we enable this again.
      The code is left intact (#ifdef'ed SP_GOTO) and the test cases are kept in
      sp-goto.test, for the future...
      
      
      mysql-test/r/sp-error.result:
        Moved all goto tests to sp-goto.test.
      mysql-test/r/sp.result:
        Moved all goto tests to sp-goto.test.
      mysql-test/t/disabled.def:
        Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
        We keep the tests in sp-goto.test for the future, but disable for now.
      mysql-test/t/sp-error.test:
        Moved all goto tests to sp-goto.test.
      mysql-test/t/sp.test:
        Moved all goto tests to sp-goto.test.
      sql/lex.h:
        Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
      sql/sql_yacc.yy:
        Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
      1ff4a0eb
    • unknown's avatar
      "Fix" for bug #11394 "Recursion in SP crash server" and bug #11600 · 0f64a495
      unknown authored
      "Stored procedures: crash with function calling itself".
      
      Disallow recursive stored routines until we either make Item's and LEX
      reentrant safe or will use spearate sp_head instances (and thus separate
      LEX objects and Item trees) for each routine invocation.
      
      
      mysql-test/r/sp-error.result:
        Added tests for bug #11394 "Recursion in SP crash server" and
        bug #11600 "Stored procedures: crash with function calling itself".
        (We simply disallow recursion for stored routines).
      mysql-test/r/sp.result:
        Disabled test cases containing recursive stored routines until we will
        support for them.
      mysql-test/t/sp-error.test:
        Added tests for bug #11394 "Recursion in SP crash server" and
        bug #11600 "Stored procedures: crash with function calling itself".
        (We simply disallow recursion for stored routines).
      mysql-test/t/sp.test:
        Disabled test cases containing recursive stored routines until we will
        support for them.
      sql/share/errmsg.txt:
        Added error message saying that recursive stored routines are disallowed.
      sql/sp_head.cc:
        sp_head::execute():
          Since many Item's and LEX members can't be used in reentrant fashion
          we have to disable recursion for stored routines. So let us track
          routine invocations using sp_head::m_is_invoked member and raise
          error when one attempts to call routine recursively.
      sql/sp_head.h:
        sp_head:
          Added m_is_invoked member for tracking of routine invocations and
          preventing recursion.
      0f64a495
  31. 08 Jun, 2005 1 commit
    • unknown's avatar
      Disable dynamic SQL in stored routines. · 3fbdaf36
      unknown authored
      This is to close Bug#10975, Bug#7115, Bug#10605 
      This feature will be implemented in a future release.
      
      
      mysql-test/r/sp-error.result:
        Test results fixed (test coverage for disabled Dynamic SQL in SP).
      mysql-test/t/sp-error.test:
        Test coverage to disable Dynamic SQL in stored routines.
      sql/sql_yacc.yy:
        Disable dynamic SQL in stored routines.
      3fbdaf36
  32. 01 Jun, 2005 1 commit
    • unknown's avatar
      Fixed BUG#10969: Stored procedures: crash if default() function · ae28b3bd
      unknown authored
        Return an error if default() is used on a local variable.
        This is actaully a side-effect of BUG#5967: Stored procedure declared
        variable used instead of column (to be fixed later), so this is really a
        workaround until that is fixed.
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#10969.
      mysql-test/t/sp-error.test:
        New test case for BUG#10969.
      sql/item.h:
        Get name of local variable for error messages.
      sql/sql_yacc.yy:
        Return an error if default() is applied on a local SP variable.
      ae28b3bd
  33. 31 May, 2005 1 commit
    • unknown's avatar
      Fixed BUG#9529: Stored Procedures: No Warning on truncation of procedure name · 3f7b0f70
      unknown authored
                      during creation.
        Although it returns an error, consistent with the behaviour for other objects.
        (Unclear why we would allow the creation of SPs with truncated names.)
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#9529.
      mysql-test/t/sp-error.test:
        New test case for BUG#9529.
      sql/sp.cc:
        Check SP name length on creation (and drop).
      sql/sp.h:
        New status code for bad (too long) name.
      sql/sql_parse.cc:
        New status code for bad (too long) name.
      3f7b0f70
  34. 27 May, 2005 1 commit
  35. 20 May, 2005 1 commit
    • unknown's avatar
      Fixed BUG#10537: Server crashes while loading data file into table through · 2a5a3de2
      unknown authored
                        procedure.
        by simply disabling 'load' in stored procedures, like it's already disabled
        for prepared statements. (They must be made "re-execution" safe before
        working with either PS or SP.)
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#10537.
      mysql-test/t/sp-error.test:
        New test case for BUG#10537.
      sql/sql_yacc.yy:
        Disable LOAD in stored procedures (just as for prepared statements).
      2a5a3de2
  36. 27 Apr, 2005 1 commit
    • unknown's avatar
      Post-review fixes of the patch for BUG#8408: Stored procedure crash if function contains SHOW · 5c44e1ac
      unknown authored
      (Review on irc by monty)
      
      
      mysql-test/r/sp-error.result:
        Renamed a procedure and function to avoid confusion
      mysql-test/t/sp-error.test:
        Renamed a procedure and function to avoid confusion
      sql/item_func.cc:
        Corrected (and better) way to set/reset the client cap. flag in Item_func_sp::execute()
      sql/share/errmsg.txt:
        Changed the ER_SP_BADSELECT error; more accurate, and includes the procedure name.
      sql/sql_parse.cc:
        Include the procedure name in the new error message.
      5c44e1ac
  37. 26 Apr, 2005 1 commit
    • unknown's avatar
      Fixed BUG#8408: Stored procedure crash if function contains SHOW · ede52616
      unknown authored
        We simply have to disallow any kind of result set being sent back
        from a function. Can't see any way to make that to work.
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#8408.
      mysql-test/t/sp-error.test:
        New test case for BUG#8408.
      sql/item_func.cc:
        Disable result sets from functions but temporarily turning CLIENT_MULTI_RESULTS off.
      sql/share/errmsg.txt:
        Added error message for statements not allowed in functions (detected during parsing).
      sql/sql_yacc.yy:
        Don't allow result sets in functions.
      ede52616