1. 27 Apr, 2011 3 commits
    • Mattias Jonsson's avatar
      Post push fix for bug#11766249 bug#59316 · 401941c2
      Mattias Jonsson authored
      Partitions can have different ref_length (position data length).
      Removed DBUG_ASSERT which crashed debug builds when using
      MAX_ROWS on some partitions.
      401941c2
    • Nirbhay Choubey's avatar
      BUG#12329909 - BUILDING MYSQL WITH DEBUG SUPPORT · a1f7ceb2
      Nirbhay Choubey authored
                     FAILS WITH LIBEDIT
      
      Fixed by checking the return value of the write()
      function calls and handling the open files and fd
      appropriately.
      
      
      cmd-line-utils/libedit/vi.c:
        BUG#12329909 - BUILDING MYSQL WITH DEBUG SUPPORT
                       FAILS WITH LIBEDIT
        
        Added a check on the return value of the write()
        function calls.
      a1f7ceb2
    • Sergey Glukhov's avatar
      Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION · a60c39a2
      Sergey Glukhov authored
      calc_daynr() function returns negative result
      if malformed date with zero year and month is used.
      Attempt to calculate week day on negative value
      leads to crash. The fix is return NULL for
      'W', 'a', 'w' specifiers if zero year and month is used.
      Additional fix for calc_daynr():
      --added assertion that result can not be negative
      --return 0 if zero year and month is used
      
      
      mysql-test/r/func_time.result:
        test case
      mysql-test/t/func_time.test:
        test case
      sql-common/my_time.c:
        --added assertion that result can not be negative
        --return 0 if zero year and month is used
      sql/item_timefunc.cc:
        eturn NULL for 'W', 'a', 'w' specifiers
        if zero year and month is used.
      a60c39a2
  2. 26 Apr, 2011 3 commits
  3. 25 Apr, 2011 1 commit
  4. 23 Apr, 2011 1 commit
  5. 22 Apr, 2011 1 commit
    • Sergey Glukhov's avatar
      Bug#11756928 48916: SERVER INCORRECTLY PROCESSING HAVING CLAUSES WITH AN ORDER BY CLAUSE · a5e8d902
      Sergey Glukhov authored
      Before sorting HAVING condition is split into two parts,
      first part is a table related condition and the rest of is
      HAVING part. Extraction of HAVING part does not take into account
      the fact that some of conditions might be non-const but
      have 'used_tables' == 0 (independent subqueries)
      and because of that these conditions are cut off by
      make_cond_for_table() function.
      The fix is to use (table_map) 0 instead of used_tables in
      third argument for make_cond_for_table() function.
      It allows to extract elements which belong to sorted
      table and in addition elements which are independend
      subqueries.
      
      
      mysql-test/r/having.result:
        test case
      mysql-test/t/having.test:
        test case
      sql/sql_select.cc:
        The fix is to use (table_map) 0 instead of used_tables in
        third argument for make_cond_for_table() function.
        It allows to extract elements which belong to sorted
        table and in addition elements which are independend
        subqueries.
      a5e8d902
  6. 20 Apr, 2011 5 commits
    • Mattias Jonsson's avatar
      merge · b3d86f12
      Mattias Jonsson authored
      b3d86f12
    • Mattias Jonsson's avatar
      merge · 046b5745
      Mattias Jonsson authored
      046b5745
    • Mattias Jonsson's avatar
      Bug#11766249 bug#59316: PARTITIONING AND INDEX_MERGE MEMORY LEAK · bd92ea43
      Mattias Jonsson authored
      Update for previous patch according to reviewers comments.
      
      Updated the constructors for ha_partitions to use the common
      init_handler_variables functions
      
      Added use of defines for size and offset to get better readability for the code that reads
      and writes the .par file. Also refactored the get_from_handler_file function.
      bd92ea43
    • Jon Olav Hauglid's avatar
      BUG#12377872 ASSERTION FAILED: !_ENTERED WHEN GETHOSTBYADDR_R · f3b024ca
      Jon Olav Hauglid authored
                   FAILS ON SOLARIS
      
      This assertion was triggered if gethostbyaddr_r cannot do a
      reverse lookup on an ip address. The reason was a missing
      DBUG_RETURN macro. The problem affected only debug versions of
      the server.
      
      This patch fixes the problem by replacing return with DBUG_RETURN.
      No test case added.
      f3b024ca
    • Sergey Glukhov's avatar
      Bug#11765923 58937: MANY VALGRIND ERRORS AFTER GROUPING BY RESULT OF DECIMAL COLUMN FUNCTION · 90bbf9d6
      Sergey Glukhov authored
      Bug#11764671  57533: UNINITIALISED VALUES IN COPY_AND_CONVERT (SQL_STRING.CC) WITH CERTAIN CHA
      When ROUND evaluates decimal result it uses Item::decimal
      value as fraction value for the result. In some cases
      Item::decimal is greater than real result fraction value
      and uninitialised memory of result(decimal) buffer can be
      used in further calculations. Issue is introduced by
      Bug33143 fix. The fix is to remove erroneous assignment.
      
      
      mysql-test/r/func_math.result:
        test case
      mysql-test/t/func_math.test:
        test case
      sql/item_func.cc:
        remove erroneous assignment
      90bbf9d6
  7. 18 Apr, 2011 3 commits
  8. 16 Apr, 2011 1 commit
  9. 15 Apr, 2011 3 commits
  10. 14 Apr, 2011 4 commits
    • Tor Didriksen's avatar
      Bug#11765713 58705: OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES CREATED BY OPT_SUM_QU · dd3d9477
      Tor Didriksen authored
      Valgrind warnings were caused by comparing index values to an un-initialized field.
      
      
      mysql-test/r/subselect.result:
        New test cases.
      mysql-test/t/subselect.test:
        New test cases.
      sql/opt_sum.cc:
        Add thd to opt_sum_query enabling it to test for errors.
        If we have a non-nullable index, we cannot use it to match null values,
        since set_null() will be ignored, and we might compare uninitialized data.
      sql/sql_select.cc:
        Add thd to opt_sum_query, enabling it to test for errors.
      sql/sql_select.h:
        Add thd to opt_sum_query, enabling it to test for errors.
      dd3d9477
    • Bjorn Munch's avatar
      Bug #12351213 MTR --VS-CONFIG DOES NOT WORK LIKE MTR_VS_CONFIG · e675ed06
      Bjorn Munch authored
      Fix for --vs-config applied
      Find.pm incorrectly tested an unitialized local variable instead
        of the global, corrected.
      Find.pm is also wrong in 5.5: uses a non-existent global variable. Fix when
        merging up.
      e675ed06
    • Serge Kozlov's avatar
      WL#5867, postfix for binlog_bug23533 · 7634e724
      Serge Kozlov authored
      7634e724
    • Sergey Glukhov's avatar
      Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL · 3abe56f3
      Sergey Glukhov authored
      There are two problems with ANALYSE():
      
      1. Memory leak 
         it happens because do_select() can overwrite
         JOIN::procedure field(with zero value in our case) and
         JOIN destructor don't free the memory allocated for
         JOIN::procedure. The fix is to save original JOIN::procedure
         before do_select() call and restore it after do_select
         execution.
      
      2. Wrong result
         If ANALYSE() procedure is used for the statement with LIMIT clause
         it could retrun empty result set. It happens because of missing 
         analyse::end_of_records() call. First end_send() function call
         returns NESTED_LOOP_QUERY_LIMIT and second call of end_send() with
         end_of_records flag enabled does not happen. The fix is to return
         NESTED_LOOP_OK from end_send() if procedure is active.
      
      
      mysql-test/r/analyse.result:
        test case
      mysql-test/t/analyse.test:
        test case
      sql/sql_select.cc:
        --save original JOIN::procedure before do_select() call and
          restore it after do_select execution.
        --return NESTED_LOOP_OK from end_send() if procedure is active
      3abe56f3
  11. 13 Apr, 2011 1 commit
  12. 12 Apr, 2011 3 commits
    • Sven Sandberg's avatar
      da267719
    • Sergey Glukhov's avatar
      Bug#11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION · 7fa7a0ca
      Sergey Glukhov authored
      When we create temporary result table for UNION
      incorrect max_length for YEAR field is used and
      it leads to incorrect field value and incorrect
      result string length as YEAR field value calculation
      depends on field length.
      The fix is to use underlying item max_length for
      Item_sum_hybrid::max_length intialization.
      
      
      mysql-test/r/func_group.result:
        test case
      mysql-test/t/func_group.test:
        test case
      sql/field.cc:
        added assert
      sql/item_sum.cc:
        init Item_sum_hybrid::max_length with 
        use underlying item max_length for
        INT result type.
      7fa7a0ca
    • Sergey Glukhov's avatar
      Bug#11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS · 33c2a5e7
      Sergey Glukhov authored
      Valgrind warning happens due to early null values check
      in Item_func_in::fix_length_and_dec(before item evaluation).
      As result null value items with uninitialized values are
      placed into array and it leads to valgrind warnings during
      value array sorting.
      The fix is to check null value after item evaluation, item
      is evaluated in in_array::set() method.
      
      
      mysql-test/r/func_in.result:
        test case
      mysql-test/t/func_in.test:
        test case
      sql/item_cmpfunc.cc:
        The fix is to check null value after item evaluation.
      33c2a5e7
  13. 11 Apr, 2011 5 commits
  14. 08 Apr, 2011 2 commits
    • Gleb Shchepa's avatar
      Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY · a77bc598
      Gleb Shchepa authored
      Select from a view with the underlying HAVING clause failed with a
      message: "1356: View '...' references invalid table(s) or column(s)
      or function(s) or definer/invoker of view lack rights to use them"
      
      The bug is a regression of the fix for bug 11750328 - 40825 (similar
      case, but the HAVING cause references an aliased field).
      In the old fix for bug 40825 the Item_field::name_length value has
      been used in place of the real length of Item_field::name. However,
      in some cases Item_field::name_length is not in sync with the
      actual name length (TODO: combine name and name_length into a
      solid String field).
      
      The Item_ref::print() method has been modified to calculate actual
      name length every time.
      
      
      mysql-test/r/view.result:
        Test case for bug #11829681
      mysql-test/t/view.test:
        Test case for bug #11829681
      sql/item.cc:
        Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
        
        The Item_ref::print() method has been modified to calculate actual
        name length every time.
      sql/item.h:
        Minor commentary.
      a77bc598
    • Nirbhay Choubey's avatar
      Bug#11765157 - 58090: mysqlslap drops schema specified in · cb0e49c0
      Nirbhay Choubey authored
                     create_schema if auto-generate-sql also set.
      
      mysqlslap uses a schema to run its tests on and later
      drops it if auto-generate-sql is used. This can be a
      problem, if the schema is an already existing one.
      
      If create-schema is used with auto-generate-sql option,
      mysqlslap while performing the cleanup, drops the specified
      database.
      
      Fixed by introducing an option --no-drop, which, if used,
      will prevent the dropping of schema at the end of the test.
      
      
      client/client_priv.h:
        Bug#11765157 - 58090: mysqlslap drops schema specified in
                       create_schema if auto-generate-sql also set.
        
        Added an option.
      client/mysqlslap.c:
        Bug#11765157 - 58090: mysqlslap drops schema specified in
                       create_schema if auto-generate-sql also set.
        
        Introduced an option 'no-drop' to forbid the removal of schema
        even if 'create' or 'auto-generate-sql' options are used.
      mysql-test/r/mysqlslap.result:
        Added a testcase for Bug#11765157.
      mysql-test/t/mysqlslap.test:
        Added a testcase for Bug#11765157.
      cb0e49c0
  15. 07 Apr, 2011 2 commits
    • Guilhem Bichot's avatar
      Fix for Bug#11765141 - "58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY WHEN ERROR OCCURS" · dc65d921
      Guilhem Bichot authored
      mysql-test/t/loaddata.test:
        test for bug; without fix, running the test with --valgrind would show the leak
        and make the test fail.
      sql/sql_load.cc:
        * In READ_INFO class, 'need_end_io_cache' is true as long as init_io_cache() was called,
        so if it's true, we need to call end_io_cache(), to free memory allocated
        by init_io_cache(). No matter the value of 'error'. In the bug's scenario,
        'error' was set to true in read_sep_field() because
        '1' (read from file) isn't suitable to load into a geometric column. Because of
        'error', end_io_cache() was not called.
        Note: end_io_cache() calls my_b_flush_io_cache(), which will do nothing wrong given
        that the file is opened for reads only; see the init_io_cache() call which uses
        only those read-only types:
        (get_it_from_net) ? READ_NET : (is_fifo ? READ_FIFO : READ_CACHE).
        IF the cache were rather used to write to the file, my_b_flush_io_cache() may
        write to it, and it may be questionable to write to the file
        if 'error' is true. But here there's no problem.
        * Now that 'need_end_io_cache' is checked even if 'error' is true, it needs
        to be initialized in all cases.
        * Bonus: move some variables to the initialization list.
      dc65d921
    • Bjorn Munch's avatar
      merge from 5.1-mtr · 9e255716
      Bjorn Munch authored
      9e255716
  16. 05 Apr, 2011 1 commit
  17. 04 Apr, 2011 1 commit
    • Georgi Kodinov's avatar
      Bug #11758687: 50924: object names not resolved correctly · 5321b3a5
      Georgi Kodinov authored
         on lctn2 systems
      
      There was a local variable in get_all_tables() to store the 
      "original" value of the database name as it can get lowercased
      depending on the lower_case_table_name value.
      get_all_tables() iterates over database names and for each 
      database iterates over the tables in it.
      The "original" db name was assigned in the table names loop.
      Thus the first table is ok, but the second and subsequent tables
      get the lowercased name from processing the first table.
      Fixed by moving the assignment of the original database name
      from the inner (table name) to the outer (database name) loop.
      Test suite added.
      5321b3a5