1. 18 Sep, 2006 1 commit
  2. 31 Aug, 2006 1 commit
    • unknown's avatar
      Fixed bug #16249: different results for a range with an without index · 53bbbc3e
      unknown authored
      when a range condition use an invalid DATETIME constant.
      Now we do not use invalid DATETIME constants to form end keys for
      range intervals: range analysis just ignores predicates with such
      constants.  
      
      
      mysql-test/r/query_cache.result:
        Adjusted result warnings when adding a fix for bug #16249.
      mysql-test/r/range.result:
        Added a test case for bug #16249.
      mysql-test/t/range.test:
        Added a test case for bug #16249.
      53bbbc3e
  3. 24 Aug, 2006 2 commits
    • unknown's avatar
      opt_range.cc: · 7d29f275
      unknown authored
        Corrected fix for bug#18165
      
      
      sql/opt_range.cc:
        Corrected fix for bug#18165
      7d29f275
    • unknown's avatar
      opt_range.cc: · 5536da97
      unknown authored
        Corrected fix for bug#18165
      
      
      sql/opt_range.cc:
        Corrected fix for bug#18165
      5536da97
  4. 22 Aug, 2006 1 commit
    • unknown's avatar
      Fixed bug 16201: a memory corruption causing crashes due to a too small · 6f91e689
      unknown authored
      buffer for a MY_BITMAP temporary buffer allocated on stack in the
      function get_best_covering_ror_intersect().
      Now the buffer of a proper size is allocated by a request from this
      function in mem_root.
      
      We succeeded to demonstrate the bug only on Windows with a very large
      database. That's why no test case is provided for in the patch.
      
      
      sql/opt_range.cc:
        Fixed bug 16201: a memory corruption causing crashes due to a too small 
        buffer for a MY_BITMAP temporary buffer allocated on stack in the
        function get_best_covering_ror_intersect().
        Now the buffer of a proper size is allocated by a request from this
        function in mem_root.
      6f91e689
  5. 16 Aug, 2006 1 commit
    • unknown's avatar
      Fixed bug #18165. · b50c3c6e
      unknown authored
      Made [NOT]BETWEEN predicates SARGable in respect to the second and 
      the third arguments.
      
      
      mysql-test/r/range.result:
        Added a test case to bug #18165.
      mysql-test/t/range.test:
        Added a test case to bug #18165.
      sql/opt_range.cc:
        Fixed bug #18165.
        Made [NOT]BETWEEN predicates SARGable in respect to the second and 
        the third arguments.
        Put in a separate function called get_full_func_mm_tree the functionality
        that builds a conjunction of all SEL_TREEs for a simple predicate of the
        form (f op c), where f was a field and c was a constant, applying different
        equalities f=f' with f' being another field.
      b50c3c6e
  6. 15 Aug, 2006 1 commit
    • unknown's avatar
      BUG#21282: Incorrect query results for "t.key NOT IN (<big const list>) · 359cb97a
      unknown authored
      In fix for BUG#15872, a condition of type "t.key NOT IN (c1, .... cN)"
      where N>1000, was incorrectly converted to
        (-inf < X < c_min) OR (c_max < X)
      Now this conversion is removed, we dont produce any range lists for such
      conditions.
      
      
      mysql-test/r/range.result:
        BUG#21282: Testcase
      mysql-test/t/range.test:
        BUG#21282: Testcase
      sql/opt_range.cc:
        BUG#21282: Incorrect query results for "t.key NOT IN (<big const list>) 
        In fix for BUG#15872, a condition of type "t.key NOT IN (c1, .... cN)"
        where N>1000, was incorrectly converted to 
          (-inf < X < c_min) OR (c_max < X)
        Now this conversion is removed, we dont produce any range lists for such
        conditions.
      359cb97a
  7. 03 Aug, 2006 1 commit
    • unknown's avatar
      Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result · ec963a61
      unknown authored
       Reseting subqueries with "quick" access methods was incomplete.
       Partially backported the correct reseting of QUICK_SELECTs from 5.x.
      
      
      mysql-test/r/subselect.result:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - test case
      mysql-test/t/subselect.test:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - test case
      sql/opt_range.cc:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - partially backported the correct reseting of QUICK_SELECTs from 5.x.
      sql/opt_range.h:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - partially backported the correct reseting of QUICK_SELECTs from 5.x.
      ec963a61
  8. 30 Jun, 2006 1 commit
  9. 28 Jun, 2006 1 commit
    • unknown's avatar
      gcc 4.1 linux warning fixes backported from 5.0. · 3cfb9f44
      unknown authored
      sql/item_cmpfunc.h:
        gcc 4.1 linux warning fixes backported from 5.0
      sql/opt_range.cc:
        gcc 4.1 linux warning fixes.
      sql/spatial.h:
        gcc 4.1 linux warning fixes backported from 5.0
      sql/sql_select.h:
        gcc 4.1 linux warning fixes.
      sql/sql_update.cc:
        gcc 4.1 linux warning fixes.
      3cfb9f44
  10. 02 Jun, 2006 1 commit
    • unknown's avatar
      Bug #4981: 4.x and 5.x produce non-optimal execution path, · 65b9d2b9
      unknown authored
              3.23 regression test failure
      
      The member SEL_ARG::min_flag was not initialized, 
      due to which the condition for no GEOM_FLAG in function 
      key_or did not choose "Range checked for each record" as 
      the correct access method.
      
      
      mysql-test/r/select.result:
        testcase for 'Range checked' access method
      mysql-test/t/select.test:
        testcase for 'Range checked' access method
      sql/opt_range.cc:
        All of the class members initialized
      65b9d2b9
  11. 16 May, 2006 1 commit
  12. 15 May, 2006 1 commit
    • unknown's avatar
      BUG#19618: Crash for unsigned_col NOT IN (-1, ... ) · baf9db8d
      unknown authored
      - When manually constructing a SEL_TREE for "t.key NOT IN(...)", take into account that 
        get_mm_parts may return a tree with type SEL_TREE::IMPOSSIBLE
      - Added missing OOM checks
      - Added comments
      
      
      mysql-test/r/func_in.result:
        Testcase for BUG#19618
      mysql-test/t/func_in.test:
        Testcase for BUG#19618
      baf9db8d
  13. 10 May, 2006 1 commit
    • unknown's avatar
      BUG#17379 Wrong reuse of E(#rows(range)) as E(#rows(ref(const))): · 7c63a144
      unknown authored
      Re-work best_access_path() and find_best() to reuse E(#rows(range access)) as
      E(#rows(ref[_or_null](const) access) only when it is appropriate.
      [This is the final cumulative patch]
      
      
      mysql-test/r/select.result:
        BUG#17379: Testcase
      mysql-test/r/subselect.result:
        BUG#17379: Updated test results
      mysql-test/t/select.test:
        BUG#17379: Testcase
      sql/opt_range.cc:
        BUG#17379: Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):
        Make range optimizer together with TABLE::quick_* also return TABLE::quick_n_ranges
      sql/sql_select.cc:
        BUG#17379: Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):
        Re-work best_access_path() to reuse E(#rows(range access)) as
        E(#rows(ref[_or_null](const) access) only when it is appropriate.
      sql/table.h:
        BUG#17379: Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):
        Make range optimizer together with TABLE::quick_* also return TABLE::quick_n_ranges
      7c63a144
  14. 25 Apr, 2006 1 commit
    • unknown's avatar
      BUG#15872: Don't run the range analyzer on "t1.keypart NOT IN (const1, ..., )", as that consumes · ccf8af40
      unknown authored
      too much memory. Instead, either create the equvalent SEL_TREE manually, or create only two ranges that
      strictly include the area to scan
      (Note: just to re-iterate: increasing NOT_IN_IGNORE_THRESHOLD will make optimization run slower for big 
      IN-lists, but the server will not run out of memory. O(N^2) memory use has been eliminated)
      
      
      mysql-test/r/func_in.result:
        Testcase for BUG#15872
      mysql-test/t/func_in.test:
        Testcase for BUG#15872
      sql/item.cc:
        BUG#15872: Added Item_decimal::set_decimal_value()
      sql/item.h:
        UG#15872: Added Item_decimal::set_decimal_value()
      sql/item_cmpfunc.h:
        BUG#15872: Added in_vector::create_item(), in_vector::value_to_item() and their implementations in concrete
        classes.
      sql/opt_range.cc:
        BUG#15872: Don't run the range analyzer on "t1.keypart NOT IN (const1, ..., )", as that 
        consumes too much memory. Instead, either 
         A) create the equivalent SEL_TREE manually, making use of the fact that item_not_in->array
            has an ordered IN-list, or
         B) create only two ranges: (-inf|NULL) < X < min_value_from_in_list,  max_value_from_in_list < X
        (Choose #B if the IN-list has > 10K elements)
      ccf8af40
  15. 13 Apr, 2006 1 commit
    • unknown's avatar
      BUG#19021, Crash in ROR-index_merge optimizer: · 44ed1179
      unknown authored
      get_best_covering_ror_intersect() was copying ror_scans starting from the 
      end of the array and not from its beginning.
      
      
      mysql-test/r/index_merge_innodb.result:
        Testcase for BUG#19021
      mysql-test/t/index_merge_innodb.test:
        Testcase for BUG#19021
      sql/opt_range.cc:
        BUG#19021: In get_best_covering_ror_intersect(), the array of pointers to
        scans to be used is [tree->ror_scans, ror_scan_mark), and not
        [ror_scan_mark, ...)
      44ed1179
  16. 31 Mar, 2006 1 commit
    • unknown's avatar
      Fix for BUG#16710. · bb839d3a
      unknown authored
      The bug was due to a missed case in the detection of whether an index
      can be used for loose scan. More precisely, the range optimizer chose
      to use loose index scan for queries for which the condition(s) over
      an index key part could not be pushed to the index together with the
      loose scan.
      
      As a result, loose index scan was selecting the first row in the
      index with a given GROUP BY prefix, and was applying the WHERE
      clause after that, while it should have inspected all rows with
      the given prefix, and apply the WHERE clause to all of them.
      
      The fix detects and skips such cases.
      
      
      mysql-test/r/group_min_max.result:
        Added test for BUG#16710.
      mysql-test/t/group_min_max.test:
        Added test for BUG#16710.
      sql/item.cc:
        Added new method [Item | Item_field]::find_item_in_field_list_processor.
      sql/item.h:
        Added new method [Item | Item_field]::find_item_in_field_list_processor.
      sql/opt_range.cc:
        Handle the case when there is no MIN/MAX aggregate function, and a
        keypart of the index being considered, that is after the GROUP BY
        prefix, is used in the WHERE clause and the condition where it is
        used cannot be pushed to the index.
        If this is the case, we rule out this index.
      bb839d3a
  17. 23 Mar, 2006 1 commit
    • unknown's avatar
      Fix for bug #18306: MySQL crashes and restarts using subquery · 9ee6088d
      unknown authored
      mysql-test/r/subselect.result:
        Fix for bug #18306: MySQL crashes and restarts using subquery
        test case
      mysql-test/t/subselect.test:
        Fix for bug #18306: MySQL crashes and restarts using subquery
        test case
      sql/opt_range.cc:
        Fix for bug #18306: MySQL crashes and restarts using subquery
        Restore thd->mem_root because
        during the cond->val_int() evaluation we can come across a subselect 
        item which may allocate memory on the thd->mem_root and assumes
        all the memory allocated has the same life span as the subselect
        item itself.
      9ee6088d
  18. 25 Feb, 2006 1 commit
    • unknown's avatar
      Fixed compiler warnings from gcc 4.0.2: · 59ebf42d
      unknown authored
      - Added empty constructors and virtual destructors to many classes and structs
      - Removed some usage of the offsetof() macro to instead use C++ class pointers
      
      
      configure.in:
        Added comment
      ndb/include/ndbapi/NdbDictionary.hpp:
        Fixed compiler warnings from gcc 4.0.2
      sql/field.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/handler.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/item.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/item_cmpfunc.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/log_event.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/mysql_priv.h:
        Fixed compiler warnings from gcc 4.0.2
        For find_table_in_list I fixed it to use proper C++ class pointers instead of C style pointers
      sql/opt_range.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/parse_file.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sp_rcontext.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/spatial.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_base.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_cache.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_class.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_parse.cc:
        Fixed compiler warnings from gcc 4.0.2
        (Not pretty, but seams to work...)
      sql/sql_select.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_update.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/table.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/tztime.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/tztime.h:
        Fixed compiler warnings from gcc 4.0.2
      59ebf42d
  19. 06 Feb, 2006 1 commit
    • unknown's avatar
      Fixed bug #16203. · 15b39844
      unknown authored
      If check_quick_select returns non-empty range then the function cost_group_min_max
      cannot return 0 as an estimate of the number of retrieved records.
      Yet the function erroneously returned 0 as the estimate in some situations.
      
      
      mysql-test/r/group_min_max.result:
        Added a test case for bug #16203.
      mysql-test/t/group_min_max.test:
        Added a test case for bug #16203.
      15b39844
  20. 05 Jan, 2006 1 commit
    • unknown's avatar
      Review fixes of new pushed code · 43886f1d
      unknown authored
      - Fixed tests
      - Optimized new code
      - Fixed some unlikely core dumps
      - Better bug fixes for:
        - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
        - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null
      
      
      mysql-test/r/create.result:
        Update results after removing wrong warnings for CREATE ... SELECT
        New tests
      mysql-test/r/handler.result:
        Drop used tables
      mysql-test/r/kill.result:
        Make test portable
      mysql-test/r/mysqlshow.result:
        Drop tables used by previous test
      mysql-test/r/trigger.result:
        Reuse old procedure name
      mysql-test/r/view.result:
        Extra tests
      mysql-test/t/create.test:
        New tests to test fix of removing wrong warnings for CREATE ... SELECT
      mysql-test/t/disabled.def:
        Enable 'kill' test (should now be portable)
      mysql-test/t/handler.test:
        Drop used tables
      mysql-test/t/kill.test:
        Make test portable even if kill doesn't work at once
      mysql-test/t/mysqlshow.test:
        Drop tables used by previous test
      mysql-test/t/trigger.test:
        Reuse old procedure name
      mysql-test/t/view.test:
        Extra tests
      sql/field.cc:
        Removed compiler warning
      sql/ha_federated.cc:
        my_snprintf -> strmake()
        (Simple optimization)
      sql/ha_ndbcluster.cc:
        Indentation cleanups and trival optimization
      sql/item.cc:
        Moved save_org_in_field() to item.cc to make it easier to test
        Remove setting of null_value as this is not needed
      sql/item.h:
        Moved save_org_in_field() to item.cc to make it easier to test
      sql/log_event.cc:
        Remove inline of slave_load_file_stem()
        Added 'extension' parameter to slave_load_file_stem() to get smaller code
        Removed not critical (or needed) DBUG_ASSERT()'s
        Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths
        Indentation fixes
      sql/opt_range.cc:
        Moved code from declaration to function body
        (To make it more readable)
      sql/parse_file.cc:
        Fixed DBUG_PRINT
      sql/sp.cc:
        Simple cleanups
        - Removed not needed {} level
        - Ensure saved variables starts with old_
      sql/sp_head.cc:
        Indentation fixes
        Remove core dump when using --debug when m_next_cached_sp == 0
        Fixed compiler warnings
        Trivial optimizations
      sql/sp_head.h:
        Changed argument to set_definer() to const
        Added THD argument to recursion_level_error() to avoid call to current_thd
      sql/sql_acl.cc:
        Removed not needed test (first_not_own_table is the guard)
      sql/sql_base.cc:
        Removed extra empty line
      sql/sql_handler.cc:
        Don't test table version in mysql_ha_read() as this is already tested in lock_tables()
        Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables
        (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash)
      sql/sql_insert.cc:
        Mark fields that are set in CREATE ... SELECT as used
        (Removed wrong warnings about field not having a default value)
      sql/sql_parse.cc:
        Removed not needed test of 'tables' (first_not_own_table is the guard)
        Simplify code
      sql/sql_select.cc:
        Use group->field to check if value is null instead of item called by 'save_org_in_field'
        This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null)
      sql/sql_trigger.cc:
        Move sql_modes_parameters outside of function
        Indentation fixes
        Fixed compiler warning
        Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access()
        (This allows us to remove the extra test in check_grant() and check_table_access())
      43886f1d
  21. 03 Jan, 2006 1 commit
    • unknown's avatar
      many warnings (practically safe but annoying) corrected · 12e22065
      unknown authored
      client/mysqladmin.cc:
        don't use the handler after it's closed
      client/mysqlbinlog.cc:
        memory leak
      client/mysqldump.c:
        many "ignore return value" warnings, one "NULL dereference"
      cmd-line-utils/libedit/history.c:
        memory leak
      include/my_base.h:
        cleanup
      libmysql/libmysql.c:
        "return value ignored" warning
      myisam/mi_delete.c:
        "return value ignored" warning
      myisam/myisampack.c:
        "out-of-bound access" warning
      myisam/sort.c:
        "double free" warning
      mysys/default_modify.c:
        "double free" warning
      mysys/mf_iocache2.c:
        "return value ignored" warnings
      mysys/my_bitmap.c:
        s/return/DBUG_RETURN/
      mysys/my_error.c:
        memory leak
      server-tools/instance-manager/parse.cc:
        "NULL dereference" warning
      sql-common/client.c:
        "NULL dereference" warning
      sql/field.cc:
        deadcode, "NULL dereference", "uninitialized" warnings
      sql/field.h:
        unused parameters removed from constructor
      sql/ha_myisam.cc:
        "return value ignored" warnings
      sql/item.cc:
        "return value ignored" warnings
        changed constructor
      sql/item_func.cc:
        "return value ignored" warnings
      sql/log_event.cc:
        uninitialized warning
      sql/opt_range.cc:
        "double free" and uninitialized warnings
      sql/opt_range.h:
        "return value ignored" warning
      sql/repl_failsafe.cc:
        "return value ignored" warning
      sql/set_var.cc:
        "return value ignored" warning
      sql/slave.cc:
        "return value ignored" warnings
      sql/slave.h:
        new prototype
      sql/sql_acl.cc:
        deadcode and "NULL dereference" warnings
      sql/sql_db.cc:
        "return value ignored" warning
      sql/sql_handler.cc:
        "NULL dereference" warning
      sql/sql_help.cc:
        "NULL dereference" warning
      sql/sql_insert.cc:
        "return value ignored" warning
      sql/sql_parse.cc:
        "return value ignored" warning
        one more DBUG_ASSERT
      sql/sql_repl.cc:
        "return value ignored" and memory leak warnings
      sql/sql_show.cc:
        "return value ignored" and "NULL dereference"  warnings
      sql/sql_test.cc:
        "return value ignored" warning
      sql/table.cc:
        memory leak
      sql/uniques.cc:
        "return value ignored" warning
        endspaces deleted
      12e22065
  22. 02 Dec, 2005 1 commit
    • unknown's avatar
      Bug#10932 - Building server with key limit of 128, makes test cases fail · 2547d3a5
      unknown authored
      Allow for configuration of the maximum number of indexes per table.
      Added and used a configure.in macro.
      Replaced fixed limits by the configurable limit.
      Limited MyISAM indexes to its hard limit.
      Fixed a bug in opt_range.cc for many indexes with InnoDB.
      
      Tested for 2, 63, 64, 65, 127, 128, 129, 255, 256, and 257 indexes.
      Testing this part of the bugfix requires rebuilding of the server 
      with different options. This cannot be done with our test suite. 
      Therefore I added the necessary test files to the bug report.
      If you repeat the tests, please note that the ps_* tests fail for
      everything but 64 indexes. This is because of differences in the 
      meta data, namely field lengths for index names etc.
      
      
      config/ac-macros/misc.m4:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Added a macro for the new build option.
      configure.in:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Added a call for the new macro.
      include/myisam.h:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Limit the number of keys for MyISAM to its hard limit.
      sql/mysql_priv.h:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Stick with the optimized Bitmap<64> if indexes are limited to 64
        or lower. Otherwise use a bigger bitmap. It must be defined as a
        multiple of 8.
      sql/opt_range.cc:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Initialize an object element to avoid a crash when using InnoDB
        with many indexes.
      sql/unireg.h:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Replace the fixed limit by the configurable limit.
      tests/mysql_client_test.c:
        Bug#10932 - Building server with key limit of 128, makes test cases fail
        Allow for configuration of the maximum number of indexes per table.
        Replace the fixed limit by the configurable limit.
      2547d3a5
  23. 25 Nov, 2005 1 commit
  24. 24 Nov, 2005 1 commit
    • unknown's avatar
      Fix bug#13293 Wrongly used index results in endless loop. · 5f120f6b
      unknown authored
      Loose index scan using only second part of multipart index was choosen, which
      results in creating wrong keys and endless loop.
      
      get_best_group_min_max() now allows loose index scan for distinct only if used
      keyparts forms a prefix of the index.
      
      
      mysql-test/t/group_min_max.test:
        Test case for bug #13293 Wrongly used index results in endless loop.
      mysql-test/r/group_min_max.result:
        Test case for bug #13293 Wrongly used index results in endless loop.
      sql/opt_range.cc:
        Fix bug #13293 Wrongly used index results in endless loop.
        get_best_group_min_max() now allows loose index scan for distinct only if used keyparts forms a prefix of the index.
      5f120f6b
  25. 20 Nov, 2005 1 commit
    • unknown's avatar
      Inefficient usage of String::append() fixed. · 5e047f6b
      unknown authored
      Bad examples of usage of a string with its length fixed.
      The incorrect length in the trigger file configuration descriptor
        fixed (BUG#14090).
      A hook for unknown keys added to the parser to support old .TRG files.
      
      
      sql/field.cc:
        Inefficient usage of String::append() fixed.
        Bad examples of usage of a string with its length fixed.
      sql/ha_berkeley.cc:
        A bad example of usage of a string with its length fixed.
      sql/ha_federated.cc:
        Inefficient usage of String::append() fixed.
      sql/ha_myisammrg.cc:
        Bad examples of usage of a string with its length fixed.
      sql/handler.cc:
        Inefficient usage of String::append() fixed.
      sql/item.cc:
        Bad examples of usage of a string with its length fixed.
      sql/item.h:
        A bad example of usage of a string with its length fixed.
      sql/item_cmpfunc.cc:
        Bad examples of usage of a string with its length fixed.
      sql/item_func.cc:
        Bad examples of usage of a string with its length fixed.
      sql/item_strfunc.cc:
        Bad examples of usage of a string with its length fixed.
      sql/item_subselect.cc:
        Bad examples of usage of a string with its length fixed.
      sql/item_sum.cc:
        Bad examples of usage of a string with its length fixed.
        Inefficient usage of String::append() fixed.
      sql/item_timefunc.cc:
        Inefficient using of String::append() fixed.
        Bad examples of usage of a string with its length fixed.
      sql/item_uniq.h:
        Bad examples of usage of a string with its length fixed.
      sql/key.cc:
        Bad examples of usage of a string with its length fixed.
      sql/log.cc:
        Bad examples of usage of a string with its length fixed.
      sql/log_event.cc:
        Bad examples of usage of a string with its length fixed.
      sql/mysqld.cc:
        The dummy parser hook allocated.
      sql/opt_range.cc:
        Inefficient usage of String::append() fixed.
      sql/parse_file.cc:
        Bad examples of usage of a string with its length fixed.
        A hook for unknown keys added to the parser.
      sql/parse_file.h:
        A hook for unknown keys added to the parser.
      sql/protocol.cc:
        A bad example of usage of a string with its length fixed.
      sql/repl_failsafe.cc:
        Bad examples of usage of a string with its length fixed.
      sql/share/errmsg.txt:
        A warning for old format config file.
      sql/slave.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sp.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sp_head.cc:
        Bad examples of usage of a string with its length fixed.
      sql/spatial.cc:
        A bad example of usage of a string with its length fixed.
      sql/sql_acl.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_analyse.cc:
        Bad examples of usage of a string with its length fixed.
        Inefficient usage of String::append() fixed.
      sql/sql_lex.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_load.cc:
        A bad example of usage of a string with its length fixed.
      sql/sql_parse.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_prepare.cc:
        A bad example of usage of a string with its length fixed.
      sql/sql_select.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_show.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_string.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_string.h:
        The macro definition moved to sql_string.h to
          be accessible in all parts of server.
      sql/sql_table.cc:
        Bad examples of usage of a string with its length fixed.
      sql/sql_trigger.cc:
        Bad examples of usage of a string with its length fixed.
        The incorrect length in the trigger file configuration descriptor
          fixed (BUG#14090).
        The hook for processing incorrect sql_mode record added.
      sql/sql_view.cc:
        A dummy  hook used for parsing views.
      sql/structs.h:
        The macro definition moved to sql_string.h to be
          accessible in all parts of server.
      sql/table.cc:
        A bad example of usage of a string with its length fixed.
      sql/tztime.cc:
        A bad example of usage of a string with its length fixed.
      5e047f6b
  26. 04 Nov, 2005 1 commit
    • unknown's avatar
      avoiding of calling Item::val_* methods family with opt_range mem_root,... · db31165c
      unknown authored
      avoiding of calling Item::val_* methods family with opt_range mem_root, because its life time is too short. (BUG#14342)
      
      
      mysql-test/r/subselect_innodb.result:
        BUG#14342 test case
      mysql-test/t/subselect_innodb.test:
        BUG#14342 test case
      sql/opt_range.cc:
        avoiding of calling Item::val_* methods family with opt_range mem_root, because its life time is too short.
      db31165c
  27. 03 Nov, 2005 3 commits
    • unknown's avatar
      opt_range.cc: · 37420b37
      unknown authored
        Additional fix for bug#14093
      
      
      sql/opt_range.cc:
        Additional fix for bug#14093
      37420b37
    • unknown's avatar
      A fix and a test case for Bug#14210 "Simple query with > operator on · e76aef36
      unknown authored
      large table gives server crash": make sure that when a MyISAM temporary
      table is created for a cursor, it's created in its memory root,
      not the memory root of the current query.
      
      
      mysql-test/r/sp.result:
        Test results fixed: a test case for Bug#14210
      mysql-test/t/sp.test:
        A test case for Bug#14210 "Simple query with > operator on large table 
        gives server crash"
      sql/handler.cc:
        - rewrite get_new_handler to accept a memory root and use it for
      sql/handler.h:
        - get_new_handler declaration changed
      sql/opt_range.cc:
        - get_new_handler declaration changed
      sql/sql_base.cc:
        - get_new_handler declaration changed
      sql/sql_select.cc:
        - the actual fix for Bug#14210. In create_myisam_from_heap we should
        create the new table handler in TABLE::mem_root, not in THD::mem_root:
        the latter is freed shortly after cursor is open.
        - adjust create_tmp_table to explicitly supply &table->mem_root
        to get_new_handler when creating a handler for a new temporary table
      sql/sql_table.cc:
        - get_new_handler declaration changed
      sql/table.cc:
        - get_new_handler declaration changed
      sql/unireg.cc:
        - get_new_handler declaration changed
      tests/mysql_client_test.c:
        A test case for Bug#14210 "Simple query with > operator on large table
         gives server crash": a C API test case is worth adding because of different
        memory allocation/freeing patterns in handling of C API and SP cursors
      e76aef36
    • unknown's avatar
      Fix bug #14093 Query takes a lot of time when date format is not valid · 898f6f28
      unknown authored
      Invalid date like 2000-02-32 wasn't converted to int, which lead to not
      using index and comparison with field as astring, which results in slow
      query execution.
      
      convert_constatn_item() and get_mm_leaf() now forces MODE_INVALID_DATES to
      allow such conversion.
      
      
      sql/item.h:
        Fix bug #14093 Query takes a lot of time when date format is not valid
        To Item_int_with_ref added method real_item() which returns ref.
      sql/item_cmpfunc.cc:
         Fix bug #14093 Query takes a lot of time when date format is not valid
        convert_constant_item() now allows conversion of invalid dates like 2000-01-32 to int to make it possible to use index when comparing fields with such dates.
      sql/opt_range.cc:
         Fix bug #14093 Query takes a lot of time when date format is not valid
        get_mm_leaf() modified so it allows index usage for comparing fields with invalid dates like 2000-01-32.
      mysql-test/r/select.result:
        Test case for bug#14093 Query takes a lot of time when date format is not valid
      mysql-test/t/select.test:
        Test case for bug#14093 Query takes a lot of time when date format is not valid
      898f6f28
  28. 19 Oct, 2005 1 commit
  29. 18 Oct, 2005 1 commit
  30. 06 Oct, 2005 1 commit
    • unknown's avatar
      Review of code pushed since last 5.0 pull: · 872a537c
      unknown authored
      Ensure that ccache is also used for C programs
      mysql: Ensure that 'delimiter' works the same way in batch mode as in normal mode
      mysqldump: Change to use ;; (instead of //) as a stored procedure/trigger delimiter
      Fixed test cases by adding missing DROP's and rename views to be of type 'v#'
      Removed MY_UNIX_PATH from fn_format()
      Removed current_db_used from TABLE_LIST
      Removed usage of 'current_thd' in Item_splocal
      Removed some compiler warnings
      A bit faster longlong2str code
      
      
      
      BUILD/FINISH.sh:
        Ensure that ccache is also used for C programs
      BUILD/SETUP.sh:
        Ensure that ccache is also used for C programs
      client/mysql.cc:
        More debugging
        Ensure that 'delimiter' works the same way in batch mode as in normal mode.
        Compare 'delimiter' command case-insensitive.
        The above fixes the delimiter bugs so that we can now use ;; as a trigger/SP function delimiter in mysqldump.
      client/mysqldump.c:
        Indentation fixes
        Use ;; as a delmimiter for stored procedures and triggers instead of //
      client/mysqltest.c:
        Indentation fixes
      include/my_sys.h:
        Remove not needed MY_UNIX_PATH parameter
      mysql-test/r/alter_table.result:
        Better to reuse mysqltest database (test didn't properly delete mysqltest1 at start)
      mysql-test/r/func_str.result:
        More testing of CONV() (to ensure that longlong2str() works correctly)
      mysql-test/r/information_schema.result:
        Drop all used tables and views
        Rename view tables to 'v#' to ensure that if this test fails, not a lot of other test fails
      mysql-test/r/information_schema_inno.result:
        Drop all used tables
      mysql-test/r/multi_statement.result:
        Drop used tables
      mysql-test/r/mysql.result:
        Add error messages to result
      mysql-test/r/mysqldump.result:
        ;; is now used as SP/trigger delimiter
      mysql-test/r/mysqlshow.result:
        Drop used tables
      mysql-test/r/temp_table.result:
        Drop used views
        Rename views to v#
      mysql-test/t/alter_table.test:
        Better to reuse mysqltest database (test didn't properly delete mysqltest1 at start)
      mysql-test/t/func_str.test:
        More testing of CONV() (to ensure that longlong2str() works correctly)
      mysql-test/t/information_schema.test:
        Drop all used tables and views
        Rename view tables to 'v#' to ensure that if this test fails, not a lot of other test fails
      mysql-test/t/information_schema_inno.test:
        Drop all used tables
      mysql-test/t/multi_statement.test:
        Drop used tables
      mysql-test/t/mysql.test:
        Add error messages to result
      mysql-test/t/mysqlshow.test:
        Drop used tables
      mysql-test/t/temp_table.test:
        Drop used views
        Rename views to v#
      mysys/mf_format.c:
        Remove not needed MY_UNIX_PATH parameter
        (This goes against how fn_format() is supposed to work and also conflicts with other options like MY_RETURN_REAL_PATH)
      sql/ha_federated.cc:
        Removed extra empty line
      sql/item.cc:
        Use 'str_value' instead of 'str_value_ptr' to hold result for Item_splocal
        Remove some calls to 'thd' in Item_splocal by making 'thd' a class variable
        One doesn't have to set 'null_value' when calling 'is_null()'
      sql/item.h:
        Add THD as a class variable to Item_splocal
        Use 'str_value' instead of 'str_value_ptr' to hold temp result
        Fixed bug in Item_hex when used in CAST()
      sql/item_func.cc:
        Optimize new code
      sql/log_event.cc:
        Move 'to_unix_path()' out of fn_format()
      sql/opt_range.cc:
        Simplify code
      sql/sp_head.cc:
        Ensure that Item_splocal has thd set before we call '->this_item()'
      sql/sql_class.cc:
        Return error if Statement::insert() fails in either hash_insert()
      sql/sql_parse.cc:
        Remove 'current_db_used' as we can trivially check if db table qualifier was used without this.
        Simplify code
      sql/sql_prepare.cc:
        Use enum instead of const int, to avoid ugly code for VC++
      sql/structs.h:
        Remove compiler warnings when using STRING_WITH_LEN() with constant strings.
      sql/table.cc:
        Fixed indentation
      sql/table.h:
        Remove not needed current_db_used
      strings/decimal.c:
        Simplify code
      strings/longlong2str-x86.s:
        A bit faster longlong2str.
        (Took some ideas from Peter Gulutzan's code)
      strings/my_strtoll10.c:
        Simplify code for MetroWerks compiler
      872a537c
  31. 30 Sep, 2005 2 commits
    • unknown's avatar
      BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT · e4de4385
      unknown authored
      optimization: now can use index to find records to update/delete
      when there is no WHERE clause.
      
      
      mysql-test/r/update.result:
        Testcase for BUG#12915
      mysql-test/t/update.test:
        Testcase for BUG#12915
      sql/mysql_priv.h:
        BUG#12915: Added init_read_record_idx function.
      sql/opt_range.cc:
        BUG#12915: Added get_index_for_order() - find an index that can be
        used to get first N table records in given ordering cheaper then 
        one would with full table scan.
      sql/opt_range.h:
        BUG#12915: Added get_index_for_order() function
      sql/records.cc:
        BUG#12915: Added init_read_record_idx(), rr_index() that allow to scan
        index using init_read_record()/read_record.read_record()
      sql/sql_delete.cc:
        BUG#12915: Added single-table DELETE ... ORDER BY ... LIMIT optimization: 
        now can use index to find records to delete when there is no WHERE clause.
      sql/sql_update.cc:
        BUG#12915: Added single-table UPDATE ... ORDER BY ... LIMIT optimization: 
        now can use index to find records to update when there is no WHERE clause.
      sql/structs.h:
        BUG#12915: Added init_read_record_idx(), rr_index() that allow to scan
        index using init_read_record()/READ_RECORD::read_record()
      e4de4385
    • unknown's avatar
      BUG#13081: Disable ROR-index_merge for NDB tables (by adding a · f8a995c1
      unknown authored
      HA_KEY_SCAN_NOT_ROR index flag) as NDB index scans are not guaranteed to be ROR 
      scans. 
      
      f8a995c1
  32. 21 Sep, 2005 1 commit
  33. 15 Sep, 2005 1 commit
    • unknown's avatar
      Fix bug #12291 Table wasn't reinited for index scan after sequential scan · 812037da
      unknown authored
      Optimizer did choose "Range checked for each record" for one of the tables.
      For first few loops over that table it choose sequential access, on later
      stage it choose to use index. Because table was previously initialized for 
      sequential access, it skips intitialization for index access, and when
      server tries to retrieve data error occurs.
      
      QUICK_RANGE_SELECT::init() changes so if file already initialized for
      sequential access, it calls ha_rnd_end() and initializes file for index
      access.
      
      
      sql/opt_range.cc:
        Fix bug #12291 Table wasn't reinited for index scan after sequential scan
      mysql-test/t/select.test:
        Test case for bug #12291 Table wasn't reinited for index scan after sequential scan
      mysql-test/r/select.result:
        Test case for bug #12291 Table wasn't reinited for index scan after sequential scan
      812037da
  34. 07 Sep, 2005 1 commit
    • unknown's avatar
      join_outer.result, opt_range.cc, item_cmpfunc.cc: · 43904698
      unknown authored
        Post merge changes
      sql_yacc.yy:
        Post merge changes
      sql_select.cc:
        Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
         for some expressions (post merge changes).
         The function add_key_fields() is modified. There cannot be NOT before
         BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
         now [NOT]BETWEEN/IN expressions.
      
      
      sql/item_cmpfunc.cc:
        Post merge changes
      sql/opt_range.cc:
        Post merge changes
      sql/sql_select.cc:
        Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
         for some expressions (post merge changes).
         The function add_key_fields() is modified. There cannot be NOT before
         BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
         now [NOT]BETWEEN/IN expressions.
      sql/sql_yacc.yy:
        Post merge changes.
      mysql-test/r/join_outer.result:
        Post merge changes
      43904698
  35. 06 Sep, 2005 1 commit
    • unknown's avatar
      item_cmpfunc.h: · 86b61e97
      unknown authored
        Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
         for some expressions.
         The classes Item_func_between, Item_func_if, Item_func_in are modified.
         Item_func_between/in objects can represent now [NOT]BETWEEN/IN expressions.
         The class Item_func_opt_neg is added to factor out the functionality
         common for the modified classes Item_func_between and Item_func_in.
      item_cmpfunc.cc:
        Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
         for some expressions.
         Added Item_func_between::fix_fields(), Item_func_if::fix_fields(),
         Item_func_in::fix_fields(). They correct generic calculation of
         the not_null_tables attribute when it is needed.
         Modified Item_func_between::val_int(), Item_func_in::val_int().
      opt_range.cc:
        Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
         for some expressions.
         The function get_mm_tree() is modified. There cannot be NOT before
         BETWEEN/IN anymore. Rather Item_func_between/in objects can represent...
      86b61e97
  36. 29 Aug, 2005 1 commit