An error occurred fetching the project authors.
  1. 25 Aug, 2006 1 commit
    • unknown's avatar
      Fixed bug #21390: wrong estimate of rows after elimination of · f121994d
      unknown authored
      const tables. This resulted in choosing extremely inefficient
      execution plans in same cases when distribution of data in
      joined were skewed (see the customer test case for the bug).
      
      
      
      mysql-test/r/select.result:
        Added a test case for bug #21390: wrong estimate of rows
        after elimination of const tables.
        Includded a test case that checks the code added by the patch
        that handles outer joins with no matches after substitution of
        a const table in an efficient way.
      mysql-test/t/select.test:
        Added a test case for bug #21390: wrong estimate of rows
        after elimination of const tables.
        Included a test case that checks the code added by the patch
        that handles outer joins with no matches after substitution of
        a const table in an efficient way.
      sql/sql_select.cc:
        Fixed bug #21390: wrong estimate of rows after elimination of
        const tables. This resulted in choosing extremely inefficient
        execution plans in same cases when distribution of data in
        joined were skewed (see the customer test case for the bug).
        Also added the code to handle outer joins with no matches after
        substitution of a const table in an efficient way. 
        Corrected calculation of the null rejecting key conditions.
      f121994d
  2. 26 Jul, 2006 1 commit
    • unknown's avatar
      Bug #21019: First result of SELECT COUNT(*) different than consecutive runs · 5ca1ee5e
      unknown authored
       When optimizing conditions like 'a = <some_val> OR a IS NULL' so that they're
       united into a single condition on the key and checked together the server must 
       check which value is the NULL value in a correct way : not only using ->is_null 
       but also check if the expression doesn't depend on any tables referenced in the 
       current statement. 
       This additional check must be performed because that optimization takes place 
       before the actual execution of the statement, so if the field was initialized 
       to NULL from a previous statement the optimization would be applied incorrectly.
      
      
      mysql-test/r/select.result:
        Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
         - test case
      mysql-test/t/select.test:
        Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
         - test case. 
           Note that ALTER TABLE is important here : it happens to
           leave the Field instance for t1.b set to NULL, witch is vital for
           demonstrating the problem fixed by this changeset.
      sql/sql_select.cc:
        Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
         - check whether a value is null taking into account its table dependency.
      5ca1ee5e
  3. 25 Jul, 2006 1 commit
    • unknown's avatar
      Fix for BUG#20954: avg(keyval) retuns 0.38 but max(keyval) returns an empty set · 585b5bbc
      unknown authored
      The problem was in that opt_sum_query() replaced MIN/MAX functions
      with the corresponding constant found in a key, but due to imprecise
      representation of float numbers, when evaluating the where clause,
      this comparison failed.
      
      When MIN/MAX optimization detects that all tables can be removed,
      also remove all conjuncts in a where clause that refer to these
      tables. As a result of this fix, these conditions are not evaluated
      twice, and in the case of float number comparisons we do not discard
      result rows due to imprecise float representation.
      
      As a side-effect this fix also corrects an unnoticed problem in
      bug 12882.
      
      
      mysql-test/r/func_group.result:
        BUG#20954 - test result adjustment.
        Adjusted the test result of bug 12882 which was not preperly fixed.
        The current patch corrects the problem that was fully corrected by the
        patch for 12882.
        
        The problem was that opt_sum_query() indicated that the optimizer may
        remove all tables because all MIN/MAX/COUNT functions are constants,
        but this lead to an empty result instead of NULL because the WHERE
        clause was still evaluated.
        
        The current fix removes all conjuncts in the where clause that
        reference the removed tables, and thus corrects the problem.
      mysql-test/r/select.result:
        BUG#20954 - added test
      mysql-test/r/subselect.result:
        BUG#20954 - test result adjustment.
        
        The fix removes those conditions in a where clause that refer to
        tables optimized away by MIN/MAX optimization (opt_sum_query()).
      mysql-test/t/select.test:
        BUG#20954 - added test
      sql/sql_select.cc:
        Fix for BUG#20954: avg(keyval) retuns 0.38 but max(keyval) returns an empty set
        
        When MIN/MAX optimization detects that all tables can be removed,
        also remove all conjuncts in a where clause that refer to these
        tables. As a result of this fix, these conditions are not evaluated
        twice, and in the case of float number comparisons we do not discard
        result rows due to imprecise float representation.
        
        As a side-effect this fix also corrects an unnoticed problem in
        bug 12882.
      585b5bbc
  4. 17 Jul, 2006 1 commit
    • unknown's avatar
      select.result, select.test: · 14d72663
      unknown authored
        Test case for bug#10977 altered to make it work in both plain and ps-protocol modes.
      
      
      mysql-test/t/select.test:
        Test case for bug#10977 altered to make it work in both plain and ps-protocol modes.
      mysql-test/r/select.result:
        Test case for bug#10977 altered to make it work in both plain and ps-protocol modes.
      14d72663
  5. 15 Jul, 2006 1 commit
    • unknown's avatar
      Fixed bug#10977: No warning issued if a column name is truncated · 1c96f2d7
      unknown authored
      When an alias is set to a column leading spaces are removed from the alias.
      But when this is done on aliases set by user this can lead to confusion.
      
      Now Item::set_name() method issues the warning if leading spaces were removed
      from an alias set by user.
      
      New warning message is added.
      
      
      mysql-test/t/select.test:
        Added test case for bug#10977:No warning issued if a column name is truncated.
      mysql-test/r/select.result:
        Added test case for bug#10977:No warning issued if a column name is truncated.
      sql/sql_yacc.yy:
        Fixed bug#10977: No warning issued if a column name is truncated
        The is_autogenerated_name flag is set before set_name() method call.
      sql/item.cc:
        Fixed bug#10977: No warning issued if a column name is truncated
        Now Item::set_name() method issues the warning if leading spaces were removed
        from an alias set by user.
      1c96f2d7
  6. 06 Jul, 2006 1 commit
    • unknown's avatar
      Bug #20569 Garbage in DECIMAL results from some mathematical functions · 8e354677
      unknown authored
        Adding decimal "digits" in multiplication resulted in signed overflow and
      producing wrong results.
      
        Fixed by using large enough buffers and intermediary result types :
      dec2 (currently longlong) to hold result of adding decimal "digits" 
      (currently int32). 
      
      
      mysql-test/r/select.result:
        Bug #20569 Garbage in DECIMAL results from some mathematical functions
          * test suite for the bug
      mysql-test/t/select.test:
        Bug #20569 Garbage in DECIMAL results from some mathematical functions
          * test suite for the bug
      strings/decimal.c:
        Bug #20569 Garbage in DECIMAL results from some mathematical functions
          * fixed the overflow in adding decimal "digits"
      8e354677
  7. 20 Jun, 2006 2 commits
    • unknown's avatar
      field.cc, field.h: · 406a7ba9
      unknown authored
        Additional fix for #16377 for bigendian platforms
      sql_select.cc, select.result, select.test:
        After merge fix
      
      
      mysql-test/t/select.test:
        After merge fix
      mysql-test/r/select.result:
        After merge fix
      sql/sql_select.cc:
        After merge fix
      sql/field.h:
        Additional fix for #16377 for bigendian platforms
      sql/field.cc:
        Additional fix for #16377 for bigendian platforms
      406a7ba9
    • unknown's avatar
      select.result: · 3e7d68b1
      unknown authored
        Added test case for bug#18759 Incorrect string to numeric conversion.  
      select.test:
        Added test case for bug#18759 Incorrect string to numeric conversion.
      item_cmpfunc.cc:
        Cleanup after fix for bug#18360 removal
      
      
      sql/item_cmpfunc.cc:
        Cleanup after fix for bug#18360 removal
      mysql-test/t/select.test:
        Added test case for bug#18759 Incorrect string to numeric conversion.
      mysql-test/r/select.result:
        Added test case for bug#18759 Incorrect string to numeric conversion.
      3e7d68b1
  8. 14 Jun, 2006 1 commit
    • unknown's avatar
      Bug #18895: BIT values cause joins to fail · 89ce81ce
      unknown authored
      The Field::eq() considered instances of Field_bit that differ only in 
      bit_ptr/bit_ofs equal. This caused equality conditions optimization 
      (build_equal_items_for_cond()) to make bad field substitutions that result
      in wrong predicates. 
      Field_bit requires an overloaded eq() function that checks the bit_ptr/bit_ofs
      in addition to Field::eq().
      
      
      mysql-test/r/select.result:
        Bug #18895: BIT values cause joins to fail
        
        - test case
      mysql-test/t/select.test:
        Bug #18895: BIT values cause joins to fail
        
        - test case
      sql/field.h:
        Bug #18895: BIT values cause joins to fail
        
        - eq() method overloaded for Field_bit
      89ce81ce
  9. 02 Jun, 2006 2 commits
    • unknown's avatar
      Removed duplicate tests from select.test · cbbd0fdb
      unknown authored
      cbbd0fdb
    • unknown's avatar
      Bug #4981: 4.x and 5.x produce non-optimal execution path, · 3390eaa0
      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
      3390eaa0
  10. 30 May, 2006 1 commit
    • unknown's avatar
      Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX · a2993441
      unknown authored
      refers to a column name.
      
      
      mysql-test/r/select.result:
        Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
        refers to a column name.
        Added a new test case.
      mysql-test/t/select.test:
        Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
        refers to a column name.
        Added a new test case.
      sql/share/czech/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/danish/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/dutch/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/english/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/estonian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/french/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/german/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/greek/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.\
      sql/share/hungarian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/italian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/japanese-sjis/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.\
      sql/share/japanese/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/korean/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/norwegian-ny/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/norwegian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/polish/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/portuguese/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/romanian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/russian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/serbian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/slovak/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/spanish/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/swedish/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      sql/share/ukrainian/errmsg.txt:
        Removed error message ER_INDEX_DOES_NOT_EXIST,
        used ER_KEY_DOES_NOT_EXITS instead.
      a2993441
  11. 28 May, 2006 1 commit
    • unknown's avatar
      Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX · 42104b2e
      unknown authored
      refers to a column name.
      Added a new error message ER_INDEX_DOES_NOT_EXIST.
      
      
      include/mysqld_error.h:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      include/sql_state.h:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      mysql-test/r/explain.result:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      mysql-test/r/key_cache.result:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      mysql-test/r/preload.result:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      mysql-test/r/select.result:
        Added a test case for bug #17873.
      mysql-test/t/explain.test:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      mysql-test/t/select.test:
        Added a test case for bug #17873.
      sql/share/czech/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/danish/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/dutch/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/english/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/estonian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/french/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/german/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/greek/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/hungarian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/italian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/japanese-sjis/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/japanese/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/korean/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/norwegian-ny/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/norwegian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/polish/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/portuguese/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/romanian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/russian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/serbian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/slovak/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/spanish/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/swedish/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      sql/share/ukrainian/errmsg.txt:
        Fixed bug #17873.
        Added a new error message ER_INDEX_DOES_NOT_EXIST.
      42104b2e
  12. 12 May, 2006 1 commit
    • unknown's avatar
      Added a test case for bug #18940:in 5.0 the optimizer chose · 5c6d923f
      unknown authored
      a worse execution plan than in 4.1 for some queries.
      It happened due the fact that at some conditions the 
      optimizer always preferred range or full index scan access
      methods to lookup access methods even when the latter were much
      cheaper. 
      The problem was not observed in 4.1 for the reported query
      because the WHERE condition was not of a form that could
      cause the problem.
      Equality propagation introduced on 5.0 added an extra 
      predicate and changed the WHERE condition. The new condition
      provoked the optimizer to make a bad choice.
      
      The problem was fixed by the patch for bug 17379.
      
      
      mysql-test/r/select.result:
        Added a test case for bug #18940.
        The problem was fixed by the patch for bug 17379.
      mysql-test/t/select.test:
        Added a test case for bug #18940.
        The problem was fixed by the patch for bug 17379.
      5c6d923f
  13. 10 May, 2006 1 commit
    • unknown's avatar
      BUG#17379 Wrong reuse of E(#rows(range)) as E(#rows(ref(const))): · 3fa6432b
      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
      3fa6432b
  14. 04 May, 2006 1 commit
  15. 01 Apr, 2006 1 commit
    • unknown's avatar
      Fixed bug #16504. · 5ef6e903
      unknown authored
      Multiple equalities were not adjusted after reading constant tables.
      It resulted in neglecting good index based methods that could be
      used to access of other tables.
      
      
      mysql-test/r/having.result:
        Adjusted a test case results after fix for bug #16504.
      mysql-test/r/select.result:
        Added a test case for bug #16504.
      mysql-test/r/subselect.result:
        Adjusted a test case results after fix for bug #16504.
      mysql-test/r/varbinary.result:
        Adjusted a test case results after fix for bug #16504.
      mysql-test/t/select.test:
        Added a test case for bug #16504.
      sql/item.cc:
        Fixed bug #16504.
        An Item_equal object may contain only a constant member.
        It may happen after reading constant tables.
      sql/item_cmpfunc.cc:
        Fixed bug #16504.
        Added method Item_equal::check_const that check appearance of new 
        constant items in a multiple equality.
      sql/item_cmpfunc.h:
        Fixed bug #16504.
        Added method Item_equal::check_const that check appearance of new 
        constant items in a multiple equality.
      sql/sql_select.cc:
        Fixed bug #16504.
        Adjusted multiple equalities after reading constant tables.
        Fixed a few typo in comments.
      5ef6e903
  16. 11 Jan, 2006 3 commits
    • unknown's avatar
      Fixed bug #15538: unchecked table absence caused server crash. · 4e2e0c6d
      unknown authored
      Absence of table in left part of LEFT/RIGHT join wasn't checked before
      name resolution which resulted in NULL dereferencing and server crash.
      
      Modified rules: 
      "table_ref LEFT opt_outer JOIN_SYM table_ref" and "table_ref RIGHT opt_outer 
      JOIN_SYM table_ref"
      NULL check is moved before push_new_name_resolution_context()
      
      
      sql/sql_yacc.yy:
        Fixed bug #15538: unchecked table absence caused server crash.
        Modified rules:
        "table_ref LEFT opt_outer JOIN_SYM table_ref" and "table_ref RIGHT opt_outer 
        JOIN_SYM table_ref"
        NULL check is moved before push_new_name_resolution_context()
      mysql-test/r/select.result:
        Added test case for bug #15538: unchecked table absence caused server crash.
      mysql-test/t/select.test:
        Added test case for bug #15538: unchecked table absence caused server crash.
      4e2e0c6d
    • unknown's avatar
      Fixed bug #15347: Wrong result of subselect when records cache and set · ddcc6d7b
      unknown authored
      functions are involved.
      
      When subselect is a join with set functions and no record have been found in
      it, end_send_group() sets null_row for all tables in order aggregate functions 
      to calculate their values correctly. Normally this null_row flag is cleared for 
      each table in sub_select(), but flush_cached_records() doesn't do so.
      Due to this all fields from the table processed by flush_cached_records() are 
      always evaluated as nulls and whole select produces wrong result.
      
      flush_cached_records() now clears null_row flag at the very beginning.
      
      
      mysql-test/t/select.test:
        Added test case for bug #15347: Wrong result of subselect when records cache
        and set functions are involved
      mysql-test/r/select.result:
        Added test case for bug #15347: Wrong result of subselect when records cache
        and set functions are involved
      sql/sql_select.cc:
        Fixed bug #15347: Wrong result of subselect when records cache and set functions are involved
        flush_cached_records() now clears null_row flag at the very beginning.
      ddcc6d7b
    • unknown's avatar
      Fixed bug #15633: Evaluation of Item_equal for non-const table caused wrong · 593bed0d
      unknown authored
      select result
      
      Item equal objects are employed only at the optimize phase. Usually they are not
      supposed to be evaluated.  Yet in some cases we call the method val_int() for
      them. Here we have to take care of restricting the predicate such an object
      represents f1=f2= ...=fn to the projection of known fields fi1=...=fik.
      
      Added a check for field's table being const in Item_equal::val_int().
      If the field's table is not const val_int() just skips that field when
      evaluating Item_equal.
      
      
      mysql-test/t/select.test:
        Added test case for bug #15633: Evaluation of Item_equal for non-const table caused wrong select result
      mysql-test/r/select.result:
        Added test case for bug #15633: Evaluation of Item_equal for non-const table caused wrong select result
      mysql-test/r/func_group.result:
        Corrected test result for bug #12882 after fix for bug#15633
      sql/item_cmpfunc.h:
        Fixed bug #15633: Evaluation of Item_equal for non-const table caused wrong select result
        Added comment about fields from non-const tables in class description.
      sql/item_cmpfunc.cc:
        Fixed bug #15633: Evaluation of Item_equal for non-const table caused wrong select result
        Added check for field's table being const in Item_equal::val_int().
      593bed0d
  17. 09 Dec, 2005 1 commit
    • unknown's avatar
      Fix bug #15268 Unchecked null value caused server crash · cb06e0c1
      unknown authored
      cmp_item_sort_string::cmp() wasn't checking values_res variable for null.
      Later called function was dereferenced it and crashed server.
      
      Added null check to cmp_item_sort_string::cmp().
      
      
      
      sql/item_cmpfunc.h:
        Fix bug#15268  Unchecked null value caused server crash
        Added null check to cmp_item_sort_string::cmp().
      mysql-test/t/select.test:
        Test case for bug#15268 Unchecked null value caused server crash
      mysql-test/r/select.result:
        Test case for bug#15268 Unchecked null value caused server crash
      cb06e0c1
  18. 26 Nov, 2005 1 commit
    • unknown's avatar
      Fixed bug #15106. · fd4fcd2f
      unknown authored
      A typo bug caused loss of a predicate of the form field=const in some cases.
      
      
      mysql-test/r/select.result:
        Added a test case for bug #15106.
      mysql-test/t/select.test:
        Added a test case for bug #15106.
      fd4fcd2f
  19. 24 Nov, 2005 1 commit
    • unknown's avatar
      Fix bug #14482 Wrongly applied optimization in resolve_const_item() caused · 3190b21f
      unknown authored
      crash
      
      resolve_const_item() substitutes item which will evaluate to constant with
      equvalent constant item, basing on the item's result type. In this case
      subselect was resolved as constant, and resolve_const_item() was substituting
      it's result's Item_caches to Item_null. Later Item_cache's function was called
      for Item_null object, which caused server crash.
      
      resolve_const_item() now substitutes constants for items with 
      result_type == ROW_RESULT only for Item_rows.
      
      
      sql/item.cc:
        Fix bug #14482 Wrongly applied optimization in resolve_const_item() caused
        crash
        
        resolve_const_item() now applies optimization for items with
        result_type == ROW_RESULT only to Item_rows.
      mysql-test/t/select.test:
        Test case for bug #14482 Wrongly applied optimization in resolve_const_item() caused crash
      mysql-test/r/select.result:
        Test case for bug #14482 Wrongly applied optimization in resolve_const_item() caused crash
      3190b21f
  20. 11 Nov, 2005 1 commit
    • unknown's avatar
      Fix for BUG#14662: view column in ORDER BY considered ambiguous if SELECT contains · 9a0da055
      unknown authored
      the same column as an aliased and as a non-aliased column.
      
      The problem was that Item_direct_view_ref::eq() was first comparing view columns
      by name, and in this case the name of one of them is different since it is aliased.
      
      
      mysql-test/r/select.result:
        Added test for BUG#14662.
      mysql-test/t/select.test:
        Added test for BUG#14662.
      sql/item.cc:
        Changed the way view column refenreces are compared. Two view columns are
        equal if they resolve to the same result field of a view.
      9a0da055
  21. 03 Nov, 2005 1 commit
    • unknown's avatar
      Fix bug #14093 Query takes a lot of time when date format is not valid · bb841518
      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
      bb841518
  22. 25 Oct, 2005 1 commit
    • unknown's avatar
      Fix for BUG#13832 - Unknown column t1.a in 'on clause'. · 3efd251a
      unknown authored
      The cause for the bug is that the priorities of all rules/terminals
      that process the FROM clause are not fully specified, and the
      parser generator produces a parser that doesn't always parse
      the FROM clause so that JOINs are left-associative. As a result
      the final join tree produced by the parser is incorrect, which
      is the cause for subsequent name resolution to fail.
      
      
      mysql-test/r/select.result:
        Test for BUG#13832.
      mysql-test/t/select.test:
        Test for BUG#13832.
      sql/sql_yacc.yy:
        Fix for BUG#13832 - Unknown column t1.a in 'on clause'.
        
        List all join-related operators as having lower priority
        than the join operands to make the parser process join-
        related productions from left to right.
      3efd251a
  23. 21 Oct, 2005 1 commit
    • unknown's avatar
      fix for bug #12595 (ESCAPE must be exactly 1 character long) · ccc051cd
      unknown authored
      ESCAPE has length of 1 if specified and sql_mode is NO_BACKSLASH_ESCAPES
      or has length of 0 or 1 in every other situation.
      (approved patch applied on a up-to-date tree re-commit) 
      
      
      mysql-test/r/select.result:
        results of test for bug 12595
      mysql-test/t/select.test:
        test for bug #12595 (ESCAPE must be exactly one character long)
      sql/item_cmpfunc.cc:
        if ESCAPE was in the statement check whether its length is
        different than 1. In NO_BACKSLASH_ESCAPES mode only length of 1 is
        allowed, otherwise the length could be 0 or 1 character (code point
        in the sense of Unicode).
      sql/item_cmpfunc.h:
        pass variable from the parsing stage - whether
        ESCAPE clause was found in the statement
      sql/sql_help.cc:
        pass FALSE for escape_used_in_parsing because we
        want the default mode of no error checking - our internal code.
      sql/sql_lex.cc:
        initialized variable used to transfer information during
        parsing up in the stack when reducing in the grammar
      sql/sql_lex.h:
        new variable used for transfering information when
        reducing in the grammar.
      sql/sql_yacc.yy:
        initialize Lex->escape_used and then use it when reducing.
        This is needed as fix for bug #12595 to distinguish between
        situation where ESCAPE was found and when not because internally
        we may pass a string an empty string and there is no other way
        to find out whether this is correct or not in case of 
        NO_BACKSLASH_ESCAPES mode, which allows only length of 1 if
        ESCAPE is part of the SQL statement.
      ccc051cd
  24. 13 Oct, 2005 4 commits
    • unknown's avatar
      Fix bug #13855 select distinct with group by caused server crash · 0390de86
      unknown authored
      DISTINCT wasn't optimized away and caused creation of tmp table in wrong
      case. This result in integer overrun and running out of memory.
      
      Fix backported from 4.1. Now if optimizer founds that in result be only 1
      row it removes distinct.
      
      
      sql/sql_select.cc:
        Fix bug #13855 select distinct with group by caused server crash
      mysql-test/r/select.result:
        Test case for bug#13855 select distinct with group by caused server crash
      mysql-test/t/select.test:
         Test case for bug#13855 select distinct with group by caused server crash
      0390de86
    • unknown's avatar
      Move handling of suffix_length from strnxfrm_bin() to filesort to ensure... · b896d334
      unknown authored
      Move handling of suffix_length from strnxfrm_bin() to filesort to ensure proper sorting of all kind of binary objects
      field::sort_key() now adds length last for varbinary/blob
      VARBINARY/BLOB is now sorted by filesort so that shorter strings comes before longer ones
      Fixed issues in test cases from last merge
      
      
      
      mysql-test/r/select.result:
        Change column name in test to get GROUP BY to use the alias
      mysql-test/r/type_blob.result:
        Test BLOB and VARCHAR sorting
      mysql-test/t/select.test:
        Change column name in test to get GROUP BY to use the alias
        Drop used tables at start of test
        Don't use table names 'a', 'b' or 'c'
      mysql-test/t/type_blob.test:
        Test BLOB and VARCHAR sorting
      sql/field.cc:
        Store length last in VARBINARY() and BLOB() columns to get shorter strings sorted before longer onces
      sql/field.h:
        Added method 'sort_length()' to allow one to have length bytes last for VARBINARY/BLOB to get these to sort properly
      sql/filesort.cc:
        Use 'sort_length()' instead of 'pack_length()' to get length of field.
        Store suffix_length last for varbinary (blob) objects.
        The above ensures that BLOB/VARBINARY are correctly sorted (shorter strings before longer ones)
      sql/sql_class.h:
        Added sort suffix length (to get varbinary/blob to sort correctly)
      sql/sql_select.cc:
        Use sort_length() instead of pack_lengths()
      strings/ctype-bin.c:
        Don't let strnxfrm_bin store length last
        Better to do it in MySQL field object to ensure it's done properly for all cases
      b896d334
    • unknown's avatar
      merging · 3d332ea7
      unknown authored
      3d332ea7
    • unknown's avatar
      Fix for bug #3874 (Group by field is not considered) · 2e887f79
      unknown authored
      mysql-test/r/select.result:
        test result fixed
      mysql-test/t/select.test:
        test case added
      sql/sql_select.cc:
        do the same for nullable
      2e887f79
  25. 12 Oct, 2005 1 commit
    • unknown's avatar
      select.test, sql_select.cc, sql_lex.cc, item.cc: · a46e8e23
      unknown authored
        Bug #7672 after merge fix
      
      
      sql/item.cc:
        Bug #7672 after merge fix
      sql/sql_lex.cc:
        Bug #7672 after merge fix
      sql/sql_select.cc:
        Bug #7672 after merge fix
      mysql-test/t/select.test:
        Bug #7672 after merge fix
      a46e8e23
  26. 09 Oct, 2005 1 commit
    • unknown's avatar
      Fix bug#7672 Unknown column error in order clause · f3f84ed8
      unknown authored
      When fixing Item_func_plus in ORDER BY clause field c is searched in all
      opened tables, but because c is an alias it wasn't found there.
      
      This patch adds a flag to select_lex which allows Item_field::fix_fields() 
      to look up in select's item_list to find aliased fields.
      
      
      sql/item.cc:
        Fix bug#7672 Unknown column error in order clause
        When fixing fields in ORDER BY clause allow Item_field::fix_fields() to look up items in select's item list to find aliased fields.
      sql/sql_lex.cc:
         Fix bug#7672 Unknown column error in order clause
      sql/sql_lex.h:
        Fix bug#7672 Unknown column error in order clause
        Added flag to select_lex allowing Item_field::fix_fields to look up items in select's item list.
      sql/sql_select.cc:
        Fix bug#7672 Unknown column error in order clause
      mysql-test/t/select.test:
        Test case for bug#7672 Unknown column error in order clause
      mysql-test/r/select.result:
        Test case for bug#7672 Unknown column error in order clause
      f3f84ed8
  27. 07 Oct, 2005 1 commit
    • unknown's avatar
      Review of new code since last pull · 3dcf2056
      unknown authored
      - Use %lx instead of %p as %p is not portable
      - Don't replace ROW item with Item_null
      
      
      myisam/mi_rkey.c:
        Use %lx instead of %p as %p is not portable
      myisam/mi_search.c:
        Use %lx instead of %p as %p is not portable
      mysql-test/r/select.result:
        More test for ROW comparison
      mysql-test/t/select.test:
        More test for ROW comparison
      sql/item.cc:
        We can't replace a ROW item with Item_null because:
        - Arg_comparator is still using the orignal row items and it's not good to have args[0] different from what is actually compared
        - If we are using the <=> comparator, NULL can still be compared as true
        - We would break things if we would ever use resolve_const_item() for operators like >, < etc.
      3dcf2056
  28. 03 Oct, 2005 1 commit
    • unknown's avatar
      Fix bug#13535 Incorrect result from SELECT statement after SHOW TABLE STATUS · 78e8833f
      unknown authored
      After SHOW TABLE STATUS last_insert_id wasn't cleaned, and next select
      erroneously rewrites WHERE condition and returs a row;
      5.0 isn't affected because of different SHOW TABLE STATUS handling.
      
      last_insert_id cleanup added to mysqld_extend_show_tables().
      
      
      sql/sql_show.cc:
        Fix bug #13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
        Added last_insert_id cleanup after SHOW TABLE STATUS command.
      mysql-test/t/select.test:
        Test case for bug #13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
      mysql-test/r/select.result:
        Test case for bug #13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
      78e8833f
  29. 30 Sep, 2005 1 commit
    • unknown's avatar
      Fix for BUG#13597 - columns in ON condition not resolved if references a table... · 68a91293
      unknown authored
      Fix for BUG#13597 - columns in ON condition not resolved if references a table in a nested right join.
      
      The problem was in that when finding the last table reference in a nested join tree,
      the procedure doing the iteration over the right-most branches of a join tree
      was testing for RIGHT JOINs the table reference that represents the join, and not
      the second operand of the JOIN. Currently the information whether a join is LEFT/RIGHT
      is stored not on the join object itself, but on one of its operands.
      
      
      mysql-test/r/select.result:
        Added test for BUG#13597
      mysql-test/t/select.test:
        Added test for BUG#13597
      sql/table.cc:
        - test whether a table reference is a right join by testing the
          rigth join operand (first in the list of operands), and not
          the table reference that represents the join itself.
        - clearer comments
      68a91293
  30. 27 Sep, 2005 1 commit
    • unknown's avatar
      Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items. · a17b3dcb
      unknown authored
      resolve_const_item() assumed to be not called for Item_row items. For
      ensuring that DBUG_ASSERT(0) was set there.
      
      This patch adds section for Item_row items. If it can it recursively calls
      resolve_const_item() for each item the Item_row contains. If any of the
      contained items is null then whole Item_row substitued by Item_null. Otherwise
      it just returns.
      
      
      sql/item.cc:
        Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items.
        
        Added section to resolve_const_item() for Item_row items. If it can it
        recursively calls resolve_const_item() for each item the Item_row contains. If
        any of the contained items is null then Item_row is substituted by Item_null.
        Otherwise it just returns.
        Comment moved closer to function it belongs to.
      mysql-test/t/select.test:
        Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items.
      mysql-test/r/select.result:
        Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items.
      a17b3dcb
  31. 20 Sep, 2005 1 commit
    • unknown's avatar
      Fix for BUG#13127. · 5f81fbb3
      unknown authored
      The problem was in the way table references are pre-filtered when
      resolving a qualified field. When resolving qualified table references
      we search recursively in the operands of the join. If there is
      natural/using join with a merge view, the first call to find_field_in_table_ref
      makes a recursive call to itself with the view as the new table reference
      to search for the column. However the view has both nested_join and
      join_columns != NULL so it skipped the test whether the view name matches
      the field qualifier. As a result the field was found in the view since the
      view already has a field with the same name. Thus the field was incorrectly
      resolved as the view field.
      
      
      mysql-test/r/select.result:
        Test for BUG#13127.
      mysql-test/t/select.test:
        Test for BUG#13127.
      sql/sql_base.cc:
        The patch contains two independent changes:
        
        - When searching for qualified fields, include merge views and information schema tables
        used with SHOW (both using TABLE_LIST::field_translation to represent result fields) in
        the test that compares the qualifying table with the name of the table reference being
        searched. This change fixes the bug.
        
        - Do not search the materialized list of columns of a NATURAL/USING join if 'table_list'
        is a stored table or merge view. Instead search directly in the table or view as if it
        is not under a natural join. This is a performance improvement since if 'table_list'
        is a stored table, then the search can utilize the name hash for table names.
      5f81fbb3
  32. 15 Sep, 2005 1 commit
    • unknown's avatar
      Fix bug #12291 Table wasn't reinited for index scan after sequential scan · 28028b5f
      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
      28028b5f
  33. 12 Sep, 2005 1 commit