1. 01 Nov, 2006 2 commits
    • unknown's avatar
      Merge mysql.com:/home/cps/mysql/trees/4.1-runtime-bug9191 · b2c40c16
      unknown authored
      into  mysql.com:/home/cps/mysql/trees/5.0-runtime-bug9191
      
      
      configure.in:
        Auto merged
      include/my_time.h:
        Auto merged
      mysql-test/r/func_time.result:
        Auto merged
      mysql-test/r/timezone2.result:
        Auto merged
      mysql-test/t/func_time.test:
        Auto merged
      mysql-test/t/timezone2.test:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/time.cc:
        Auto merged
      BitKeeper/deleted/.del-acinclude.m4~f4ab416bac5003:
        Auto merged
      sql-common/my_time.c:
        manual merge
      sql/item_timefunc.cc:
        manual merge
      sql/tztime.cc:
        manual merge
      b2c40c16
    • unknown's avatar
      Fix Bug #9191 "TIMESTAMP/from_unixtime() no longer accepts 2^31-1" · 8a7bc052
      unknown authored
      (4.1 version, with post-review fixes)
        
        The fix for another Bug (6439) limited FROM_UNIXTIME() to
        TIMESTAMP_MAX_VALUE which is 2145916799 or 2037-12-01 23:59:59 GMT,
        however unix timestamp in general is not considered to be limited 
        by this value. All dates up to power(2,31)-1 are valid.
        
        This patch extends allowed TIMESTAMP range so, that max
        TIMESTAMP value is power(2,31)-1. It also corrects
        FROM_UNIXTIME() and UNIX_TIMESTAMP() functions, so that
        max allowed UNIX_TIMESTAMP() is power(2,31)-1. FROM_UNIXTIME()
        is fixed accordingly to allow conversion of dates up to
        2038-01-19 03:14:07 UTC. The patch also fixes CONVERT_TZ()
        function to allow extended range of dates.
        
        The main problem solved in the patch is possible overflows
        of variables, used in broken-time representation to time_t
        conversion (required for UNIX_TIMESTAMP).
      
      
      acinclude.m4:
        Add new macro to check time_t range
      configure.in:
        Call the macro to check time_t range
      include/my_time.h:
        Move time-related defines to proper place.
        Add a function to perform a rough check if
        a TIMESTAMP value fits into the boundaries.
        Note: it is defined as "static inline", as
        otherwise libmysql won't compile (due to the
        way how gcc handles "inline" directive).
      mysql-test/r/func_time.result:
        Update test result
      mysql-test/r/timezone.result:
        Update test result
      mysql-test/r/timezone2.result:
        Update test result
      mysql-test/t/func_time.test:
        Add test for Bug#9191 and update test to be consistent
        with new TIMESTAMP boundaries
      mysql-test/t/timezone.test:
        Update old tests to be consistent
        with new TIMESTAMP boundaries
      mysql-test/t/timezone2.test:
        Update tests for convert_tz to be consistent with new
        TIMESTAMP boundaries
      sql/item_timefunc.cc:
        Fix convert_tz to allow dates from the new (extended)
        TIMESTAMP range
      sql/mysql_priv.h:
        Move time handling defaults to my_time.h
      sql-common/my_time.c:
        Because of increased TIMESTAMP_MAX_VALUE overflows in my_system_gmt_sec()
        became possible. Here we make it safe against the overflows by stepping
        back from the boundary dates which are likely to trigger them.
      sql/time.cc:
        Update TIME_to_timestamp to allow conversion of
        extended date range
      sql/tztime.cc:
        Fix new (4.1) implementation of broken-down time representation
        to time_t conversion routine to avoid overflows during conversion
        of boundary dates
      mysql-test/r/timezone4.result:
        New BitKeeper file ``mysql-test/r/timezone4.result''
      mysql-test/t/timezone4-master.opt:
        New BitKeeper file ``mysql-test/t/timezone4-master.opt''
      mysql-test/t/timezone4.test:
        New BitKeeper file ``mysql-test/t/timezone4.test''
      8a7bc052
  2. 20 Oct, 2006 3 commits
    • unknown's avatar
      Instance Manager polishing. · 8db4dc3f
      unknown authored
      
      server-tools/instance-manager/guardian.cc:
        1. Removed unused stop_instances_arg from request_shutdown() and
        stop_instances() methods.
        
        2. Changed log-output statements so that instance name is passed
        correctly (char *, not LEX_STRING)
      server-tools/instance-manager/guardian.h:
        Removed unused stop_instances_arg from request_shutdown() and
        stop_instances() methods.
      server-tools/instance-manager/instance.cc:
        Removed unused stop_instances_arg from request_shutdown() and
        stop_instances() methods.
      server-tools/instance-manager/listener.cc:
        Be more verbose in log.
      server-tools/instance-manager/manager.cc:
        Removed unused stop_instances argument.
      8db4dc3f
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime · a6273e6d
      unknown authored
      into  mockturtle.local:/home/dlenev/src/mysql-5.0-bg15228-2
      
      
      sql/sql_trigger.cc:
        Auto merged
      sql/sql_view.cc:
        Auto merged
      a6273e6d
    • unknown's avatar
      Fix for bug#15228 "'invalid access to non-static data member' · 1a793de9
      unknown authored
      warnings in sql_trigger.cc and sql_view.cc".
      
      According to the current version of C++ standard offsetof() macro
      can't be used for non-POD types. So warnings were emitted when we
      tried to use this macro for TABLE_LIST and Table_triggers_list
      classes. Note that despite of these warnings it was probably safe
      thing to do.
      
      This fix tries to circumvent this limitation by implementing
      custom version of offsetof() macro to be used with these
      classes. This hack should go away once we will refactor
      File_parser class.
      
      Alternative approaches such as disabling this warning for
      sql_trigger.cc/sql_view.cc or for the whole server were
      considered less explicit. Also I was unable to find a way
      to disable particular warning for particular _part_ of
      file in GCC.
      
      
      sql/parse_file.h:
        Introduced auxillary macro which can be used instead of offsetof()
        to get offsets of members in class for non-POD types without getting
        warnings (assuming that all instances of the class has same offsets
        for same members).
      sql/sql_trigger.cc:
        Use my_offsetof() macro instead of standard offsetof() macro with
        Table_triggers_list class in order to avoid warnings (offsetof()
        cannot be used for non-POD types according to the standard).
      sql/sql_view.cc:
        Use my_offsetof() macro instead of standard offsetof() macro with
        TABLE_LIST class in order to avoid warnings (offsetof() cannot
        be used for non-POD types according to the standard).
      1a793de9
  3. 19 Oct, 2006 3 commits
    • unknown's avatar
      Bug#20028 (Function with select return no data) · 5bd58f3e
      unknown authored
      This patch reverts a change introduced by Bug 6951, which incorrectly
      set thd->abort_on_warning for stored procedures.
      
      As per internal discussions about the SQL_MODE=TRADITIONAL,
      the correct behavior is to *not* abort on warnings even inside an INSERT/UPDATE
      trigger.
      
      Tests for Stored Procedures, Stored Functions, Triggers involving SQL_MODE
      have been included or revised, to reflect the intended behavior.
      
      (reposting approved patch, to work around source control issues, no review needed)
      
      
      mysql-test/include/sp-vars.inc:
        Tests for SQL_MODE='TRADITIONAL'
      mysql-test/r/sp-vars.result:
        Tests for SQL_MODE='TRADITIONAL'
      mysql-test/r/sp.result:
        Tests for SQL_MODE='TRADITIONAL'
      mysql-test/r/trigger.result:
        Tests for SQL_MODE='TRADITIONAL'
      mysql-test/t/sp-vars.test:
        Tests for SQL_MODE='TRADITIONAL'
      mysql-test/t/sp.test:
        Tests for SQL_MODE='TRADITIONAL'
      mysql-test/t/trigger.test:
        Tests for SQL_MODE='TRADITIONAL'
      sql/sp_head.cc:
        For SQL_MODE='TRADITIONAL',
        thd->abort_on_warning should be set only when assigning a *column*
      5bd58f3e
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · de304106
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21856
      
      
      sql/sql_parse.cc:
        Auto merged
      mysql-test/r/ps.result:
        Manual merge.
      mysql-test/t/ps.test:
        Manual merge.
      de304106
    • unknown's avatar
      BUG#21856: Prepared Statements: crash if bad create · ef2d2165
      unknown authored
      When statement to be prepared contained CREATE PROCEDURE, CREATE FUNCTION
      or CREATE TRIGGER statements with a syntax error in it, the preparation
      would fail with syntax error message, but the memory could be corrupted.
      
      The problem occurred because we switch memroot when parse stored
      routine or trigger definitions, and on parse error we restored the
      original memroot only after performing some memory operations.  In more
      detail:
       - prepared statement would activate its own memory root to parse
         the definition of the stored procedure.
       - SP would reset this memory root with its own memory root to
         parse SP statements
       - a syntax error would happen
       - prepared statement would restore the original memory root
       - stored procedure would restore what it thinks was the original
         memory root, but actually was the statement memory root.
      That led to double free - in destruction of the statement and in
      a next call to mysql_parse().
      
      The solution is to restore memroot right after the failed parsing.
      
      
      mysql-test/r/ps.result:
        Add result for bug#21856: Prepared Statements: crash if bad create.
      mysql-test/t/ps.test:
        Add test case for bug#21856: Prepared Statements: crash if bad create.
      sql/sql_parse.cc:
        On parse error if thd->lex->sphead is set we have to free sp_head object
        to restore statement memroot, if it was switched during parsing.
        
        The change here is for safety, currently query_cache_abort() and
        lex->unit.cleanup() calls do not use current memroot.
      sql/sql_prepare.cc:
        On parse error if thd->lex->sphead is set we have to free sp_head object
        to restore statement memroot, if it was switched during parsing.
      ef2d2165
  4. 18 Oct, 2006 1 commit
    • unknown's avatar
      Fix for valgrind warning introduced by the fix for bug#21354: · cc558cfb
      unknown authored
      (COUNT(*) = 1) not working in SELECT inside prepared statement.
      Note: the warning was introduced in 5.0 and 5.1, 4.1 is OK with the
      original fix.
      
      The problem was that in 5.0 and 5.1 clear() for group functions may
      access hybrid_type member, and this member is initialized in
      fix_fields().
      
      So we should not call clear() from item cleanup() methods, as cleanup()
      may be called for unfixed items.
      
      
      sql/item_sum.cc:
        Do not call clear() from item cleanup() methods, as cleanup() may be
        called for unfixed items, and clear() assumes the item was fixed.
      sql/item_sum.h:
        Do not call clear() from item cleanup() methods, as cleanup() may be
        called for unfixed items, and clear() assumes the item was fixed.
      cc558cfb
  5. 17 Oct, 2006 2 commits
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 687bb161
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21726
      
      
      mysql-test/r/rpl_insert_id.result:
        Auto merged
      mysql-test/t/rpl_insert_id.test:
        Auto merged
      sql/item_func.cc:
        Auto merged
      sql/item_func.h:
        Auto merged
      sql/log_event.cc:
        Auto merged
      sql/set_var.cc:
        Auto merged
      sql/sql_class.h:
        Auto merged
      sql/sql_insert.cc:
        Auto merged
      sql/sql_load.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/sql_update.cc:
        Auto merged
      tests/mysql_client_test.c:
        Auto merged
      687bb161
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1-bug21726 · 00fca9ea
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21726
      
      
      mysql-test/r/rpl_insert_id.result:
        Use local.
      mysql-test/t/rpl_insert_id.test:
        Use local.
      sql/item_func.cc:
        Use local.
      sql/item_func.h:
        Use local.
      sql/log_event.cc:
        Use local.
      sql/set_var.cc:
        Use local.
      sql/sql_class.h:
        Use local.
      sql/sql_insert.cc:
        Use local.
      sql/sql_load.cc:
        Use local.
      sql/sql_parse.cc:
        Use local.
      sql/sql_select.cc:
        Use local.
      sql/sql_update.cc:
        Use local.
      tests/mysql_client_test.c:
        Use local.
      00fca9ea
  6. 12 Oct, 2006 3 commits
    • unknown's avatar
      Fix after manual merge. · 1c1fd2a4
      unknown authored
      
      mysql-test/t/sp-error.test:
        Move test for bug#20953 to the end of file.
      1c1fd2a4
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 649f3d54
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug20953
      
      
      mysql-test/r/view.result:
        Auto merged
      mysql-test/t/sp-error.test:
        Auto merged
      mysql-test/t/view.test:
        Auto merged
      sql/sql_lex.cc:
        Auto merged
      sql/sql_lex.h:
        Auto merged
      sql/sql_view.cc:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      mysql-test/r/sp-error.result:
        Manual merge.
      649f3d54
    • unknown's avatar
      BUG#20953: create proc with a create view that uses local vars/params · 6d1fdc73
      unknown authored
                 should fail to create
      
      The problem was that this type of errors was checked during view
      creation, which doesn't happen when CREATE VIEW is a statement of
      a created stored routine.
      
      The solution is to perform the checks at parse time.  The idea of the
      fix is that the parser checks if a construction just parsed is allowed
      in current circumstances by testing certain flags, and this flags are
      reset for VIEWs.
      
      The side effect of this change is that if the user already have
      such bogus routines, it will now get a error when trying to do
      
        SHOW CREATE PROCEDURE proc;
      
      (and some other) and when trying to execute such routine he will get
      
        ERROR 1457 (HY000): Failed to load routine test.p5. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
      
      However there should be very few such users (if any), and they may
      (and should) drop these bogus routines.
      
      
      mysql-test/r/sp-error.result:
        Add result for bug#20953: create proc with a create view that uses
        local vars/params should fail to create.
      mysql-test/r/view.result:
        Update results.
      mysql-test/t/sp-error.test:
        Add test case for bug#20953: create proc with a create view that uses
        local vars/params should fail to create.
      mysql-test/t/view.test:
        Add second test for variable in a view.
        Remove SP variable in a view test, as it tests wrong behaviour.
        Add test for derived table in a view.
      sql/sql_lex.cc:
        Remove LEX::variables_used.
      sql/sql_lex.h:
        Remove LEX::variables_used and add st_parsing_options structure and
        LEX::parsing_options member.
      sql/sql_view.cc:
        Move some error checking to sql/sql_yacc.yy.
      sql/sql_yacc.yy:
        Check for disallowed syntax in a CREATE VIEW at parse time to rise a
        error when it is used inside CREATE PROCEDURE and CREATE FUNCTION, as
        well as by itself.
      6d1fdc73
  7. 10 Oct, 2006 10 commits
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 82db5471
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21354
      
      
      82db5471
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 41eb26c9
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug19111
      
      
      41eb26c9
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · bc513624
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21354
      
      
      mysql-test/t/func_gconcat.test:
        Auto merged
      sql/item_sum.cc:
        Auto merged
      mysql-test/r/ps.result:
        Manual merge.
      mysql-test/t/ps.test:
        Manual merge.
      bc513624
    • unknown's avatar
      Fix after manial merge. · c942d5bf
      unknown authored
      c942d5bf
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1-bug21354 · e32f277c
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21354
      
      
      mysql-test/t/func_gconcat.test:
        Auto merged
      sql/item_sum.cc:
        Auto merged
      mysql-test/r/ps.result:
        Manual merge.
      mysql-test/t/ps.test:
        Manual merge.
      sql/item_sum.h:
        Manual merge.
      e32f277c
    • unknown's avatar
      BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared · 3177e8eb
      unknown authored
                 statement.
      
      The problem was that during statement re-execution if the result was
      empty the old result could be returned for group functions.
      
      The solution is to implement proper cleanup() method in group
      functions.
      
      
      mysql-test/r/ps.result:
        Add result for bug#21354: (COUNT(*) = 1) not working in SELECT inside
        prepared statement.
      mysql-test/t/func_gconcat.test:
        Add a comment that the test case is from bug#836.
      mysql-test/t/ps.test:
        Add test case for bug#21354: (COUNT(*) = 1) not working in SELECT inside
        prepared statement.
      sql/item_sum.cc:
        Call clear() in Item_sum_count::cleanup().
      sql/item_sum.h:
        Add comments.
        Add proper cleanup() methods.
        Change Item_sum::no_rows_in_result() to call clear() instead of reset(),
        as the latter also issues add(), and there is nothing to add when there
        are no rows in result.
      3177e8eb
    • unknown's avatar
      Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime · 537ad02d
      unknown authored
      into  mysql.com:/home/cps/mysql/trees/mysql-5.0-virgin
      
      
      537ad02d
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 9fdd94a7
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug19111
      
      
      sql/sql_base.cc:
        Auto merged
      mysql-test/r/view.result:
        Manual merge.
      mysql-test/t/view.test:
        Manual merge.
      9fdd94a7
    • unknown's avatar
      Bug#19111: TRIGGERs selecting from a VIEW on the firing base table fail. · 469ff92d
      unknown authored
      In a trigger or a function used in a statement it is possible to do
      SELECT from a table being modified by the statement.  However,
      encapsulation of such SELECT into a view and selecting from a view
      instead of direct SELECT was not possible.
      
      This happened because tables used by views (which in their turn
      were used from functions/triggers) were not excluded from checks
      in unique_table() routine as it happens for the rest of tables
      added to the statement table list for prelocking.
      
      With this fix we ignore all such tables in unique_table(), thus
      providing consistency: inside a trigger or a functions SELECT from
      a view may be used where plain SELECT is allowed.  Modification of
      the same table from function or trigger is still disallowed.  Also,
      this patch doesn't affect the case where SELECT from the table being
      modified is done outside of function of trigger, such SELECTs are
      still disallowed (this limitation and visibility problem when function
      select from a table being modified are subjects of bug 21326).  See
      also bug 22427.
      
      
      mysql-test/r/view.result:
        Add result for bug#19111: TRIGGERs selecting from a VIEW on the
        firing base table fail.
      mysql-test/t/view.test:
        Add test case for bug#19111: TRIGGERs selecting from a VIEW on the
        firing base table fail.
      sql/sql_base.cc:
        In unique_table() do not check tables that are used in a stored
        function or a trigger ('prelocking_placeholder' is set).  If such
        function or a trigger will attempt to modify a table, the error will
        be given, however select is allowed there.
      469ff92d
    • unknown's avatar
      Merge bodhi.local:/opt/local/work/mysql-5.0-root · f20d34f4
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime
      
      
      mysql-test/mysql-test-run.pl:
        Auto merged
      f20d34f4
  8. 09 Oct, 2006 1 commit
    • unknown's avatar
      Bug#21462 (Stored procedures with no arguments require parenthesis) · e1e0f829
      unknown authored
      The syntax of the CALL statement, to invoke a stored procedure, has been
      changed to make the use of parenthesis optional in the argument list.
      With this change, "CALL p;" is equivalent to "CALL p();".
      
      While the SQL spec does not explicitely mandate this syntax, supporting it
      is needed for practical reasons, for integration with JDBC / ODBC connectors.
      
      Also, warnings in the sql/sql_yacc.yy file, which were not reported by Bison 2.1
      but are now reported by Bison 2.2, have been fixed.
      
      The warning found were:
      bison -y -p MYSQL  -d --debug --verbose sql_yacc.yy
      sql_yacc.yy:653.9-18: warning: symbol UNLOCK_SYM redeclared
      sql_yacc.yy:656.9-17: warning: symbol UNTIL_SYM redeclared
      sql_yacc.yy:658.9-18: warning: symbol UPDATE_SYM redeclared
      sql_yacc.yy:5169.11-5174.11: warning: unused value: $2
      sql_yacc.yy:5208.11-5220.11: warning: unused value: $5
      sql_yacc.yy:5221.11-5234.11: warning: unused value: $5
      conflicts: 249 shift/reduce
      
      "unused value: $2" correspond to the $$=$1 assignment in the 1st {} block
      in table_ref -> join_table {} {},
      which does not procude a result ($$) for the rule but an intermediate $2
      value for the action instead.
      "unused value: $5" are similar, with $$ assignments in {} actions blocks
      which are not for the final reduce.
      
      
      mysql-test/r/sp.result:
        New test case for Bug#21462
      mysql-test/t/sp.test:
        New test case for Bug#21462
      sql/sql_yacc.yy:
        "CALL p;" syntax for calling a stored procedure
        Fixed bison 2.2 warnings.
      e1e0f829
  9. 08 Oct, 2006 3 commits
  10. 06 Oct, 2006 9 commits
    • unknown's avatar
      Merge mysql.com:/home/svoj/devel/mysql/BUG22937/mysql-4.1-engines · 12fb87ac
      unknown authored
      into  mysql.com:/home/svoj/devel/mysql/BUG22937/mysql-5.0-engines
      
      
      sql/ha_myisammrg.cc:
        Manual merge.
      12fb87ac
    • unknown's avatar
      Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-4.1-engines · a6a93d6f
      unknown authored
      into  mysql.com:/home/svoj/devel/mysql/BUG22937/mysql-4.1-engines
      
      
      a6a93d6f
    • unknown's avatar
      BUG#22937 - Valgrind failure in 'merge' test (ha_myisammrg.cc:329) · 47a70282
      unknown authored
      This is addition to fix for bug21617. Valgrind reports an error when
      opening merge table that has underlying tables with less indexes than
      in a merge table itself.
      
      Copy at most min(file->keys, table->key_parts) elements from rec_per_key array.
      This fixes problems when merge table and subtables have different number of keys.
      
      
      sql/ha_myisammrg.cc:
        Copy at most min(file->keys, table->key_parts) elements from rec_per_key array.
        This fixes problems when merge table and subtables have different number of keys.
      47a70282
    • unknown's avatar
      Merge mysql.com:/home/svoj/devel/mysql/BUG21381/mysql-4.1-engines · 0caaf1d1
      unknown authored
      into  mysql.com:/home/svoj/devel/mysql/BUG21381/mysql-5.0-engines
      
      
      mysql-test/r/ndb_update.result:
        Auto merged
      mysql-test/t/ndb_update.test:
        Auto merged
      0caaf1d1
    • unknown's avatar
    • unknown's avatar
      BUG#21726: Incorrect result with multiple invocations of LAST_INSERT_ID. · f603c1cc
      unknown authored
      Note: bug#21726 does not directly apply to 4.1, as it doesn't have stored
      procedures.  However, 4.1 had some bugs that were fixed in 5.0 by the
      patch for bug#21726, and this patch is a backport of those fixes.
      Namely, in 4.1 it fixes:
      
        - LAST_INSERT_ID(expr) didn't return value of expr (4.1 specific).
      
        - LAST_INSERT_ID() could return the value generated by current
          statement if the call happens after the generation, like in
      
            CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
            INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
      
        - Redundant binary log LAST_INSERT_ID_EVENTs could be generated.
      
      
      mysql-test/r/rpl_insert_id.result:
        Add result for bug#21726: Incorrect result with multiple invocations
        of LAST_INSERT_ID.
      mysql-test/t/rpl_insert_id.test:
        Add test case for bug#21726: Incorrect result with multiple invocations
        of LAST_INSERT_ID.
      sql/item_func.cc:
        Add implementation of Item_func_last_insert_id::fix_fields(), where we
        set THD::last_insert_id_used when statement calls LAST_INSERT_ID().
        In Item_func_last_insert_id::val_int(), return THD::current_insert_id
        if called like LAST_INSERT_ID(), otherwise return value of argument if
        called like LAST_INSERT_ID(expr).
      sql/item_func.h:
        Add declaration of Item_func_last_insert_id::fix_fields().
      sql/log_event.cc:
        Do not set THD::last_insert_id_used on LAST_INSERT_ID_EVENT.  Though we
        know the statement will call LAST_INSERT_ID(), it wasn't called yet.
      sql/set_var.cc:
        In sys_var_last_insert_id::value_ptr(), set THD::last_insert_id_used,
        and return THD::current_insert_id for @@LAST_INSERT_ID.
      sql/sql_class.h:
        Update comments.
        Remove THD::insert_id(), as it has lost its purpose now.
      sql/sql_insert.cc:
        Now it is OK to read THD::last_insert_id directly.
      sql/sql_load.cc:
        Now it is OK to read THD::last_insert_id directly.
      sql/sql_parse.cc:
        In mysql_execute_command(), remember THD::last_insert_id (first
        generated value of the previous statement) in THD::current_insert_id,
        which then will be returned for LAST_INSERT_ID() and @@LAST_INSERT_ID.
      sql/sql_select.cc:
        If "IS NULL" is replaced with "= <LAST_INSERT_ID>", use right value,
        which is THD::current_insert_id, and also set THD::last_insert_id_used
        to issue binary log LAST_INSERT_ID_EVENT.
      sql/sql_update.cc:
        Now it is OK to read THD::last_insert_id directly.
      tests/mysql_client_test.c:
        Add test case for bug#21726: Incorrect result with multiple invocations
        of LAST_INSERT_ID.
      f603c1cc
    • unknown's avatar
      Addition to fix for bug#10974. Fixed spelling. · 15d2a32c
      unknown authored
      15d2a32c
    • unknown's avatar
      Merge mysql.com:/home/svoj/devel/mysql/BUG10974/mysql-4.1-engines · ada458cc
      unknown authored
      into  mysql.com:/home/svoj/devel/mysql/BUG10974/mysql-5.0-engines
      
      
      BitKeeper/deleted/.del-errmsg.txt~f96b7055cac394e:
        Auto merged
      mysql-test/r/merge.result:
        Manual merge.
      ada458cc
    • unknown's avatar
      Addition to fix for bug#10974. Fixed spelling. · f463cb38
      unknown authored
      f463cb38
  11. 05 Oct, 2006 3 commits