An error occurred fetching the project authors.
  1. 26 Jul, 2006 1 commit
    • unknown's avatar
      Bug#21039 Transaction cache not flushed after SELECT CREATE · 8bf8776c
      unknown authored
       - Add prelocking for stored procedures that uses sp or sf
       - Update test result for sp_error(reported as bug#21294)
       - Make note about new error message from sp-error(bug#17244)
      
      
      mysql-test/r/sp-error.result:
        Update test result(reported as bug#21294)
      mysql-test/r/sp_notembedded.result:
        Update test result after disabling test case
      mysql-test/t/sp-error.test:
        Add note about the faulty error message
      mysql-test/t/sp_notembedded.test:
        Disable test case until bug#17244 has been fixed
      sql/sp.cc:
        Add prelocking for all stored procedures that uses another sp or sf
      sql/sp.h:
        Add prelocking for all stored procedures that uses another sp or sf
      sql/sql_base.cc:
        Add prelocking for all stored procedures that uses another sp or sf
      8bf8776c
  2. 01 Jun, 2006 1 commit
    • unknown's avatar
      Bug#19066 (DELETE FROM inconsistency for NDB): · ddc25698
      unknown authored
      Under row-based replication, DELETE FROM will now always be
      replicated as individual row deletions, while TRUNCATE TABLE will
      always be replicated as a statement.
      
      
      mysql-test/extra/rpl_tests/rpl_ddl.test:
        Using --echo instead of SELECT to print message.
      mysql-test/r/binlog_row_mix_innodb_myisam.result:
        Result change.
      mysql-test/r/federated.result:
        Result change.
      mysql-test/r/range.result:
        Result change.
      mysql-test/r/rpl_sp_effects.result:
        Result change.
      mysql-test/r/show_check.result:
        Result change.
      mysql-test/r/sp-error.result:
        Result change.
      mysql-test/r/sp.result:
        Result change.
      mysql-test/r/timezone2.result:
        Result change.
      mysql-test/r/trigger-grant.result:
        Result change.
      mysql-test/r/type_datetime.result:
        Result change.
      mysql-test/r/type_ranges.result:
        Result change.
      mysql-test/r/type_timestamp.result:
        Result change.
      mysql-test/r/view.result:
        Result change.
      mysql-test/t/archive.test:
        Test contain statements that only works for statement-based logging.
      mysql-test/t/disabled.def:
        Disabling test due to reported bug.
      mysql-test/t/federated.test:
        Adding ORDER BY clause to SELECT statements
      mysql-test/t/range.test:
        Adding ORDER BY clause to SELECT (sub-)statement
      mysql-test/t/rpl_sp_effects.test:
        Adding ORDER BY clause to SELECT statement.
      mysql-test/t/show_check.test:
        Replacing DELETE FROM without WHERE with TRUNCATE TABLE.
      mysql-test/t/sp-error.test:
        Replacing DELETE FROM without WHERE with TRUNCATE TABLE.
      mysql-test/t/sp.test:
        Adding ORDER BY clause to SELECT statement.
      mysql-test/t/timezone2.test:
        Replacing DELETE FROM without WHERE with TRUNCATE TABLE.
      mysql-test/t/trigger-grant.test:
        Replacing DELETE FROM without WHERE with TRUNCATE TABLE.
      mysql-test/t/type_datetime.test:
        Adding ORDER BY clause to SELECT statement.
      mysql-test/t/type_ranges.test:
        Replacing DELETE FROM without WHERE with TRUNCATE TABLE.
      mysql-test/t/type_timestamp.test:
        Replacing DELETE FROM without WHERE with TRUNCATE TABLE.
      mysql-test/t/view.test:
        Adding ORDER BY clause to SELECT statement.
      sql/sql_class.h:
        Adding member function to set replication to statement-based.
      sql/sql_delete.cc:
        When row-based replication is used, DELETE FROM will always delete the
        contents of the table row-by-row and not use delete_all_rows().
      mysql-test/extra/rpl_tests/rpl_truncate.test:
        New BitKeeper file ``mysql-test/extra/rpl_tests/rpl_truncate.test''
      mysql-test/extra/rpl_tests/rpl_truncate_helper.inc:
        New BitKeeper file ``mysql-test/extra/rpl_tests/rpl_truncate_helper.inc''
      mysql-test/r/rpl_truncate_2myisam.result:
        New BitKeeper file ``mysql-test/r/rpl_truncate_2myisam.result''
      mysql-test/r/rpl_truncate_3innodb.result:
        New BitKeeper file ``mysql-test/r/rpl_truncate_3innodb.result''
      mysql-test/r/rpl_truncate_7ndb.result:
        New BitKeeper file ``mysql-test/r/rpl_truncate_7ndb.result''
      mysql-test/t/rpl_truncate_2myisam.test:
        New BitKeeper file ``mysql-test/t/rpl_truncate_2myisam.test''
      mysql-test/t/rpl_truncate_3innodb.test:
        New BitKeeper file ``mysql-test/t/rpl_truncate_3innodb.test''
      mysql-test/t/rpl_truncate_7ndb.test:
        New BitKeeper file ``mysql-test/t/rpl_truncate_7ndb.test''
      ddc25698
  3. 15 Mar, 2006 1 commit
    • unknown's avatar
      A fix and test case for Bug#16164 "Easter egg": · 271d20ba
      unknown authored
      SHOW AUTHORS caused 'Packets out of order' in stored functions:
      add the corresponding SQLCOM to sp_get_flags_for_command so that
      it'd return sp-related flags for it. 
      Fix Bug#17403 "Events: packets out of order with show create event"
      in the same chaneset.
      
      
      mysql-test/r/events.result:
        Update the results (Bug#17403)
      mysql-test/r/sp-error.result:
        Test results fixed (Bug#16164)
      mysql-test/t/events.test:
        Add a test case for Bug#17403 "Events: packets out of order with
        show create event"
      mysql-test/t/sp-error.test:
        Add a test case for Bug#16164 "Easter egg"
      sql/sp_head.cc:
        Add SHOW AUTHORS to the list of commands that return a result
        set: such commands are not allowed in stored functions and
        triggers. Add SHOW CREATE EVENT for the same reason.
      271d20ba
  4. 24 Feb, 2006 1 commit
    • unknown's avatar
      Fixes to embedded server to be able to run tests with it · 0afb6ff6
      unknown authored
      (Needed for "list of pushes" web page and autopush)
      
      
      include/mysql.h:
        Fix to embedded server to be able to run tests on it
      libmysql/libmysql.c:
        Fix to embedded server to be able to run tests on it
      libmysqld/emb_qcache.cc:
        Fix to embedded server to be able to run tests on it
      libmysqld/embedded_priv.h:
        Fix to embedded server to be able to run tests on it
      libmysqld/lib_sql.cc:
        Fix to embedded server to be able to run tests on it
      libmysqld/libmysqld.c:
        Fix to embedded server to be able to run tests on it
      mysql-test/mysql-test-run.sh:
        Fix to embedded server to be able to run tests on it
      mysql-test/r/binlog.result:
        Updated test for embedded server
      mysql-test/r/ctype_cp932.result:
        Updated test for embedded server
      mysql-test/r/innodb.result:
        Updated test for embedded server
      mysql-test/r/mysqltest.result:
        Updated test for embedded server
      mysql-test/r/query_cache.result:
        Updated test for embedded server
      mysql-test/r/query_cache_notembedded.result:
        Updated test for embedded server
      mysql-test/r/sp-error.result:
        Updated test for embedded server
      mysql-test/r/sp.result:
        Updated test for embedded server
      mysql-test/r/subselect.result:
        Updated test for embedded server
      mysql-test/r/view.result:
        Updated test for embedded server
      mysql-test/r/view_grant.result:
        Updated test for embedded server
      mysql-test/t/backup.test:
        Updated test for embedded server
      mysql-test/t/binlog.test:
        Updated test for embedded server
      mysql-test/t/blackhole.test:
        Updated test for embedded server
      mysql-test/t/compress.test:
        Updated test for embedded server
      mysql-test/t/ctype_cp932.test:
        Updated test for embedded server
      mysql-test/t/delayed.test:
        Updated test for embedded server
      mysql-test/t/handler.test:
        Updated test for embedded server
      mysql-test/t/innodb.test:
        Updated test for embedded server
      mysql-test/t/mysql.test:
        Updated test for embedded server
      mysql-test/t/mysql_client_test.test:
        Updated test for embedded server
      mysql-test/t/mysqltest.test:
        Updated test for embedded server
      mysql-test/t/query_cache.test:
        Updated test for embedded server
      mysql-test/t/query_cache_notembedded.test:
        Updated test for embedded server
      mysql-test/t/read_only.test:
        Updated test for embedded server
      mysql-test/t/skip_grants.test:
        Updated test for embedded server
      mysql-test/t/sp-destruct.test:
        Updated test for embedded server
      mysql-test/t/sp-error.test:
        Updated test for embedded server
      mysql-test/t/sp-threads.test:
        Updated test for embedded server
      mysql-test/t/sp.test:
        Updated test for embedded server
      mysql-test/t/subselect.test:
        Updated test for embedded server
      mysql-test/t/temp_table.test:
        Updated test for embedded server
      mysql-test/t/view.test:
        Updated test for embedded server
      mysql-test/t/view_grant.test:
        Updated test for embedded server
      mysql-test/t/wait_timeout.test:
        Updated test for embedded server
      mysys/mf_dirname.c:
        Review fix: Don't access data outside of array
      mysys/my_bitmap.c:
        Remove compiler warnings
      scripts/mysql_fix_privilege_tables.sql:
        Add flush privileges to .sql script so that one doesn't have to reboot mysqld when one runs the mysql_fix_privilege_script
      sql-common/client.c:
        Updated test for embedded server
      sql/item.cc:
        Remove DBUG_PRINT statement that can cause crashes when running with --debug
      sql/mysqld.cc:
        Fix to embedded server to be able to run tests on it
      sql/protocol.cc:
        Fix to embedded server to be able to run tests on it
        (Trivial reconstruction of code)
      sql/protocol.h:
        Fix to embedded server to be able to run tests on it
      sql/sql_base.cc:
        Better comment
      sql/sql_class.cc:
        Fix to embedded server to be able to run tests on it
      sql/sql_class.h:
        Fix to embedded server to be able to run tests on it
      sql/sql_cursor.cc:
        Fix to embedded server to be able to run tests on it
      sql/sql_parse.cc:
        Fix to embedded server to be able to run tests on it
        Don't crash for disabled commands when using embedded server
      sql/sql_prepare.cc:
        Fix to embedded server to be able to run tests on it
      mysql-test/r/ctype_cp932_notembedded.result:
        New BitKeeper file ``mysql-test/r/ctype_cp932_notembedded.result''
      mysql-test/r/innodb_notembedded.result:
        New BitKeeper file ``mysql-test/r/innodb_notembedded.result''
      mysql-test/r/sp.result.orig:
        New BitKeeper file ``mysql-test/r/sp.result.orig''
      mysql-test/r/sp_notembedded.result:
        New BitKeeper file ``mysql-test/r/sp_notembedded.result''
      mysql-test/r/subselect_notembedded.result:
        New BitKeeper file ``mysql-test/r/subselect_notembedded.result''
      mysql-test/t/ctype_cp932_notembedded.test:
        New BitKeeper file ``mysql-test/t/ctype_cp932_notembedded.test''
      mysql-test/t/innodb_notembedded.test:
        New BitKeeper file ``mysql-test/t/innodb_notembedded.test''
      mysql-test/t/sp.test.orig:
        New BitKeeper file ``mysql-test/t/sp.test.orig''
      mysql-test/t/sp_notembedded.test:
        New BitKeeper file ``mysql-test/t/sp_notembedded.test''
      mysql-test/t/subselect_notembedded.test:
        New BitKeeper file ``mysql-test/t/subselect_notembedded.test''
      0afb6ff6
  5. 16 Feb, 2006 1 commit
    • unknown's avatar
      Fixed BUG#17015: Routine name truncation not an error · 8dd6e145
      unknown authored
        The name length was checked "the old way", not taking charsets into account,
        when creating a stored routine.
        Fixing this enforces the real limit (64 characters) again, and no truncation
        is possible.
      
      
      mysql-test/r/sp-error.result:
        Updated results for BUG#17015.
      mysql-test/t/sp-error.test:
        Added and modified test case for BUG#17015 (and 9529).
      sql/sp.cc:
        When creating a routine, check the length of the name the correct way,
        taking the charsets into account.
      8dd6e145
  6. 09 Feb, 2006 1 commit
    • unknown's avatar
      Fixed BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION · 0fd78492
      unknown authored
        Check if AGGREGATE was given with a stored (non-UDF) function, and return
        error in that case.
        Also made udf_example/udf_test work again, by adding a missing *_init()
        function. (_init() functions required unless --allow_suspicious_udfs is
        given to the server, since March 2005 - it seems udf_example wasn't updated
        at the time.)
      
      
      mysql-test/r/sp-error.result:
        Updated results for BUG#16896.
      mysql-test/t/sp-error.test:
        Added test case for BUG#16896.
      sql/share/errmsg.txt:
        New error message: ER_SP_NO_AGGREGATE
      sql/sql_yacc.yy:
        Check if AGGREGATE was used when creating a stored function (i.e. not an UDF).
      sql/udf_example.cc:
        Added myfunc_int_init() function to make it work when the server is running without
        --allow_suspicious_udfs.
      0fd78492
  7. 31 Jan, 2006 2 commits
  8. 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
  9. 04 Jan, 2006 1 commit
    • unknown's avatar
      Big patch to make embedded-server working in 5.x · 6b27acbd
      unknown authored
      Now it supports queries returning several results
      (particularly important with the SP)
      
      
      include/mysql.h:
        embedded_query_result structure added
      libmysql/libmysql.c:
        embedded-server related fixes
      libmysqld/emb_qcache.cc:
        multiple-result support added
      libmysqld/embedded_priv.h:
        embedded_query_result struct implemented
      libmysqld/lib_sql.cc:
        multiple-result support added
      libmysqld/libmysqld.c:
        small fixes
      mysql-test/t/backup.test:
        test fixed
      mysql-test/t/binlog_stm_binlog.test:
        test fixed
      mysql-test/t/binlog_stm_blackhole.test:
        test fixed
      mysql-test/t/binlog_stm_ctype_cp932.test:
        test fixed
      mysql-test/t/compress.test:
        test fixed
      mysql-test/t/delayed.test:
        test fixed
      mysql-test/t/federated.test:
        test fixed
      mysql-test/t/federated_archive.test:
        test fixed
      mysql-test/t/federated_bug_13118.test:
        test fixed
      mysql-test/t/federated_transactions.test:
        test fixed
      mysql-test/t/flush_table.test:
        test fixed
      mysql-test/t/handler.test:
        test fixed
      mysql-test/t/init_connect.test:
        test fixed
      mysql-test/t/innodb.test:
        test fixed
      mysql-test/t/mysql.test:
        test fixed
      mysql-test/t/mysql_client_test.test:
        test fixed
      mysql-test/t/mysqltest.test:
        test fixed
      mysql-test/t/query_cache.test:
        test fixed
      mysql-test/t/query_cache_notembedded.test:
        test fixed
      mysql-test/t/read_only.test:
        test fixed
      mysql-test/t/skip_grants.test:
        test fixed
      mysql-test/t/sp-destruct.test:
        test fixed
      mysql-test/t/sp-error.test:
        test fixed
      mysql-test/t/sp-threads.test:
        test fixed
      mysql-test/t/sp.test:
        test fixed
      mysql-test/t/view.test:
        test fixed
      mysql-test/t/wait_timeout.test:
        test fixed
      sql-common/client.c:
        small fixes
      sql/mysqld.cc:
        embedded-server related fix
      sql/protocol.cc:
        embedded-server related fix
      sql/protocol.h:
        embedded-server related fix
      sql/sql_class.cc:
        embedded-server related fix
      sql/sql_class.h:
        embedded-server related fix
      sql/sql_cursor.cc:
        embedded-server related fix
      sql/sql_parse.cc:
        embedded-server related fix
      sql/sql_prepare.cc:
        embedded-server related fix
      6b27acbd
  10. 07 Dec, 2005 1 commit
    • 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
  11. 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
  12. 02 Dec, 2005 1 commit
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 15 Aug, 2005 1 commit
    • unknown's avatar
      Save and clear run context before executing a stored function or trigger and restore it afterwards. · a914b527
      unknown authored
      This allows us to use statement replication with functions and triggers
      The following things are fixed with this patch:
      - NOW() and automatic timestamps takes the value from the main event for functions and triggers (which allows these to replicate with statement level logging)
      - No side effects for triggers or functions with auto-increment values(), last_insert_id(), rand() or found_rows()
      - Triggers can't return result sets
      
      Fixes bugs:
      #12480: NOW() is not constant in a trigger
      #12481: Using NOW() in a stored function breaks statement based replication
      #12482: Triggers has side effects with auto_increment values
      #11587: trigger causes lost connection error
      
      
      mysql-test/r/trigger.result:
        Added test fpr big
      mysql-test/t/sp-error.test:
        Changed error message numbers
      mysql-test/t/trigger.test:
        Added test for trigger returning result (#11587)
      sql/item_func.cc:
        Store the first used seed value for RAND() value.
        (This makes rand() replicatable in functions and triggers)
        Save and clear run context before executing a stored function and restore it afterwards.
        This removes side effects of stored functions for RAND(), auto-increment values and NOW() and makes most stored function replicatable
      sql/share/errmsg.txt:
        Reuse error message also for triggers
      sql/sp_head.cc:
        If in function or trigger, don't change value of NOW()
        (This allows us to use statement replication with functions that directly or indirectly uses timestamps)
      sql/sql_class.cc:
        Added framework for storing and retrieving run context while exceuting triggers or stored functions.
      sql/sql_class.h:
        Added framework for storing and retrieving run context while exceuting triggers or stored functions.
      sql/sql_parse.cc:
        If in function or trigger, don't change value of NOW()
        (This allows us to use statement replication with functions that directly or indirectly uses timestamps)
      sql/sql_trigger.cc:
        Moved process_triggers function from sql_trigger.h
        Use reset/restore sub_statement_state while executing triggers to avoid side effects and make them replicatable
      sql/sql_trigger.h:
        Moved process_triggers function from sql_trigger.h
        Use reset/restore sub_statement_state while executing triggers to avoid side effects and make them replicatable
      sql/sql_yacc.yy:
        Give error message if trigger can return a result set (Bug #11587)
      tests/fork_big2.pl:
        Removed return from end of lines
      mysql-test/r/rpl_trigger.result:
        New BitKeeper file ``mysql-test/r/rpl_trigger.result''
      mysql-test/t/rpl_trigger.test:
        New BitKeeper file ``mysql-test/t/rpl_trigger.test''
      a914b527
  29. 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
  30. 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
  31. 09 Jul, 2005 2 commits
    • unknown's avatar
      Manual fixes after merging patch for bug #8406 "Triggers crash if referencing · d0c69a82
      unknown authored
      a table" with main tree.
      
      
      mysql-test/r/trigger.result:
        Temporalily disable part of test which exposes bug #11554 (work on which is in
        progress).
      mysql-test/t/sp-error.test:
        After merge fix.
          Fixed wrong delimiter command.
      mysql-test/t/trigger.test:
        Temporalily disable part of test which exposes bug #11554 (work on which is in
        progress).
      sql/sp.cc:
        After merge fix.
          Item_arena was renamed to Query_arena.
      sql/sp.h:
        After merge fix.
          Item_arena was renamed to Query_arena.
      sql/sql_lex.cc:
        After merge fix.
          LEX::spfuns/spprocs hashes were replaces with one LEX::sroutines hash.
      d0c69a82
    • 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
  32. 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
  33. 06 Jul, 2005 1 commit
    • unknown's avatar
      After merge fix. · 4727620b
      unknown authored
      mysql-test/t/sp-error.test:
        Fixed error-codes after merging changes from the main tree.
      4727620b
  34. 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
  35. 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
  36. 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
  37. 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