An error occurred fetching the project authors.
  1. 06 Jun, 2007 1 commit
  2. 02 Jun, 2007 1 commit
    • unknown's avatar
      Fixed bug #28728: a crash when executing EXPLAIN EXTENDED for a query · 8c4ff24b
      unknown authored
      using a derived table over a grouping subselect.
      
      This crash happens only when materialization of the derived tables 
      requires creation of auxiliary temporary table, for example when
      a grouping operation is carried out with usage of a temporary table.
      
      The crash happened because EXPLAIN EXTENDED when printing the query
      expression made an attempt to use the objects created in the mem_root
      of the temporary table which has been already freed by the moment
      when printing is called.
      
      This bug appeared after the method Item_field::print() had been 
      introduced.    
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #28728.
      mysql-test/t/subselect.test:
        Added a test case for bug #28728.
      sql/sql_select.cc:
        Fixed bug #28728: a crash when executing EXPLAIN EXTENDED for a query
        using a derived table over a grouping subselect.
        The crash happened because EXPLAIN EXTENDED when printing the query
        expression made an attempt to use the objects created in the mem_root
        of the temporary table which has been already freed by the moment
        when printing is accomplished.
        The fix in JOIN::exec() ensures using existing objects when printing 
        subselects for a derived tables by EXPLAIN EXTENDED.
      8c4ff24b
  3. 17 May, 2007 1 commit
    • unknown's avatar
      Fixed bug #28337: wrong results for grouping queries with correlated · dd1a1180
      unknown authored
      subqueries in WHERE conditions.
      This bug was introduced by the patch for bug 27321.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #28337.
      mysql-test/t/subselect.test:
        Added a test case for bug #28337.
      sql/item.cc:
        Fixed bug #28337: wrong results for grouping queries with correlated
        subqueries in WHERE conditions.
        This bug was introduced by the patch for bug 27321.
        
        Now in the Item_field::fix_outer_field function we create an Item_outer_ref
        object for an outer reference only if it is used in the SELECT list or
        in the HAVING clause of the subquery against which the reference is resolved.
      dd1a1180
  4. 04 May, 2007 1 commit
    • unknown's avatar
      Bug #27807. · 0ad4e1b2
      unknown authored
      Non-correlated scalar subqueries may get executed
      in EXPLAIN at the optimization phase if they are
      part of a right hand sargable expression.
      If the scalar subquery uses a temp table to 
      materialize its results it will replace the 
      subquery structure from the parser with a simple
      select from the materialization table.
      As a result the EXPLAIN will crash as the 
      temporary materialization table is not to be shown
      in EXPLAIN at all.
      Fixed by preserving the original query structure
      right after calling optimize() for scalar subqueries
      with temp tables executed during EXPLAIN.
      
      
      mysql-test/r/subselect.result:
        Bug #27807: test case
      mysql-test/t/subselect.test:
        Bug #27807: test case
      sql/item_subselect.cc:
        Bug #27807: preserve the join structure
      sql/sql_select.cc:
        Bug #27807: introduce initialization function for tmp_join
      sql/sql_select.h:
        Bug #27807: introduce initialization function for tmp_join
      0ad4e1b2
  5. 26 Apr, 2007 2 commits
    • unknown's avatar
      Bug#27590: Wrong DATE/DATETIME comparison. · 7bb6a725
      unknown authored
      DATE and DATETIME can be compared either as strings or as int. Both
      methods have their disadvantages. Strings can contain valid DATETIME value
      but have insignificant zeros omitted thus became non-comparable with
      other DATETIME strings. The comparison as int usually will require conversion
      from the string representation and the automatic conversion in most cases is
      carried out in a wrong way thus producing wrong comparison result. Another
      problem occurs when one tries to compare DATE field with a DATETIME constant.
      The constant is converted to DATE losing its precision i.e. losing time part.
      
      This fix addresses the problems described above by adding a special
      DATE/DATETIME comparator. The comparator correctly converts DATE/DATETIME
      string values to int when it's necessary, adds zero time part (00:00:00)
      to DATE values to compare them correctly to DATETIME values. Due to correct
      conversion malformed DATETIME string values are correctly compared to other
      DATE/DATETIME values.
      
      As of this patch a DATE value equals to DATETIME value with zero time part.
      For example '2001-01-01' equals to '2001-01-01 00:00:00'.
      
      The compare_datetime() function is added to the Arg_comparator class.
      It implements the correct comparator for DATE/DATETIME values.
      Two supplementary functions called get_date_from_str() and get_datetime_value()
      are added. The first one extracts DATE/DATETIME value from a string and the
      second one retrieves the correct DATE/DATETIME value from an item.
      The new Arg_comparator::can_compare_as_dates() function is added and used
      to check whether two given items can be compared by the compare_datetime()
      comparator.
      Two caching variables were added to the Arg_comparator class to speedup the
      DATE/DATETIME comparison.
      One more store() method was added to the Item_cache_int class to cache int
      values.
      The new is_datetime() function was added to the Item class. It indicates
      whether the item returns a DATE/DATETIME value.
      
      
      sql/item.cc:
        Bug#27590: Wrong DATE/DATETIME comparison.
        One more store() method was added to the Item_cache_int class to cache int
        values.
        The new is_datetime() function was added to the Item class. It indicates
        whether the item returns a DATE/DATETIME value.
      sql/item.h:
        Bug#27590: Wrong DATE/DATETIME comparison.
        One more store() method was added to the Item_cache_int class to cache int
        values.
        The new is_datetime() function was added to the Item class. It indicates
        whether the item returns a DATE/DATETIME value.
      sql/item_cmpfunc.cc:
        Bug#27590: Wrong DATE/DATETIME comparison.
        The compare_datetime() function is added to the Arg_comparator class.
        It implements the correct comparator for DATE/DATETIME values.
        Two supplementary functions called get_date_from_str() and get_datetime_value()
        are added. The first one extracts DATE/DATETIME value from a string and the
        second one retrieves the correct DATE/DATETIME value from an item.
        The new Arg_comparator::can_compare_as_dates() function is added and used
        to check whether two given items can be compared by the compare_datetime()
        comparator.
      sql/item_cmpfunc.h:
        Bug#27590: Wrong DATE/DATETIME comparison.
        The compare_datetime() function is added to the Arg_comparator class.
        It implements the correct comparator for DATE/DATETIME values.
        Two supplementary functions called get_date_from_str() and get_datetime_value()
        are added. The first one extracts DATE/DATETIME value from a string and the
        second one retrieves the correct DATE/DATETIME value from an item.
        The new Arg_comparator::can_compare_as_dates() function is added and used
        to check whether two given items can be compared by the compare_datetime()
        comparator.
        Two caching variables were added to the Arg_comparator class to speedup the
        DATE/DATETIME comparison.
      mysql-test/include/ps_conv.inc:
        Test case adjusted after fix for bug#27590.
      mysql-test/r/distinct.result:
        Test cases results are corrected after fix for bug#27590.
      sql/sql_select.cc:
        Bug#27590: Wrong DATE/DATETIME comparison.
        The test_if_equality_guarantees_uniqueness() function now uses
        Arg_comparator::can_compare_as_dates() to detect comparable DATE/DATETIME items.
      mysql-test/r/ps_2myisam.result:
        The result of the adjusted test case after fix for bug#27590.
      mysql-test/r/ps_3innodb.result:
        The result of the adjusted test case after fix for bug#27590.
      mysql-test/r/ps_4heap.result:
        The result of the adjusted test case after fix for bug#27590.
      mysql-test/r/ps_5merge.result:
        The result of the adjusted test case after fix for bug#27590.
      mysql-test/r/subselect.result:
        Test cases results are corrected after fix for bug#27590.
      mysql-test/r/type_datetime.result:
        Added a test case for the bug#27590: Wrong DATE/DATETIME comparison.
      mysql-test/t/type_datetime.test:
        Added a test case for the bug#27590: Wrong DATE/DATETIME comparison.
      tests/mysql_client_test.c:
        Test case adjusted after fix for bug#27590.
      7bb6a725
    • unknown's avatar
      Bug #27363: · e14fd2b6
      unknown authored
      Validity checks for nested set functions
      were not taking into account that the enclosed
      set function may be on a nest level that is
      lower than the nest level of the enclosing set
      function.
      Fixed by :
       - propagating max_sum_func_level
      up the enclosing set functions chain.
       - updating the max_sum_func_level of the 
         enclosing set function when the enclosed set
         function is aggregated above or on the same
         nest level of as the level of the enclosing 
         set function.
       - updating the max_arg_level of the enclosing
         set function on a reference that refers to
         an item above or on the same nest level
         as the level of the enclosing set function.
       - Treating both Item_field and Item_ref as possibly
         referencing items from outer nest levels.
      
      
      mysql-test/r/subselect.result:
        Bug #27363: test cases
      mysql-test/t/subselect.test:
        Bug #27363: test cases
      sql/item.cc:
        Bug #27363:
        Treat the reference as an outer reference for the
        enclosing set function even if it's referencing
        an item that is above the nest level of the
        enclosing set function.
        Consider both Item_field and Item_ref.
      sql/item_sum.cc:
        Bug #27363: Use the enclosed set function aggregation
        level to mark the enclosing set function even 
        if it's aggregated on a level that is above the 
        nest level of the enclosing set function.
        Pass max_sum_func_level up the accending branch of the
        recursion because it must take into account each
        directly or indirectly nested set function.
      e14fd2b6
  6. 20 Apr, 2007 1 commit
    • unknown's avatar
      Bug#27704: incorrect comparison of rows with NULL components · a8f639fc
      unknown authored
      Support for NULL components was incomplete for row comparison,
      fixed.  Added support for abort_on_null at compare_row() like
      in 5.x
      
      
      sql/item_cmpfunc.h:
        Bug#27704: incorrect comparison of rows with NULL components
        Added support for abort_on_null at Item_bool_func2
        like in 5.x
      sql/item_cmpfunc.cc:
        Bug#27704: incorrect comparison of rows with NULL components
        Support for NULL components was incomplete for row comparison,
        fixed. Added support for abort_on_null at compare_row() like
        in 5.x
      mysql-test/t/row.test:
        Test case updated for Bug#27704 (incorrect comparison 
        of rows with NULL components)
      mysql-test/r/row.result:
        Test case updated for Bug#27704 (incorrect comparison 
        of rows with NULL components)
      mysql-test/r/subselect.result:
        Test case updated for Bug#27704 (incorrect comparison 
        of rows with NULL components)
      a8f639fc
  7. 15 Apr, 2007 2 commits
    • unknown's avatar
      subselect.test, subselect.result: · 6ad00742
      unknown authored
        After merge fix.
      
      
      mysql-test/r/subselect.result:
        After merge fix.
      mysql-test/t/subselect.test:
        After merge fix.
      6ad00742
    • unknown's avatar
      Bug#27321: Wrong subquery result in a grouping select. · 1cf3b965
      unknown authored
      The Item_outer_ref class based on the Item_direct_ref class was always used
      to represent an outer field. But if the outer select is a grouping one and the 
      outer field isn't under an aggregate function which is aggregated in that
      outer select an Item_ref object should be used to represent such a field.
      If the outer select in which the outer field is resolved isn't grouping then
      the Item_field class should be used to represent such a field.
      This logic also should be used for an outer field resolved through its alias
      name.
      
      Now the Item_field::fix_outer_field() uses Item_outer_field objects to
      represent aliased and non-aliased outer fields for grouping outer selects
      only.
      Now the fix_inner_refs() function chooses which class to use to access outer
      field - the Item_ref or the Item_direct_ref. An object of the chosen class
      substitutes the original field in the Item_outer_ref object.
      The direct_ref and the found_in_select_list fields were added to the
      Item_outer_ref class.
      
      
      mysql-test/t/subselect3.test:
        Some test cases were corrected after the fix for the bug#27321.
      mysql-test/r/subselect3.result:
        Some test cases were corrected after the fix for the bug#27321.
      mysql-test/t/subselect.test:
        Added a test case for the bug#27321: Wrong subquery result in a grouping select.
      mysql-test/r/subselect.result:
        Added a test case for the bug#27321: Wrong subquery result in a grouping select.
        Some test cases were corrected after this fix.
      sql/sql_union.cc:
        Bug#27321: Wrong subquery result in a grouping select.
        Cleanup of the inner_refs_list.
      sql/sql_select.cc:
        Bug#27321: Wrong subquery result in a grouping select.
        Now the fix_inner_refs() function chooses which class to use to access outer
        field - the Item_ref or the Item_direct_ref. An object of the chosen class
        substitutes the original field in the Item_outer_ref object.
        A comment is corrected.
      sql/item.cc:
        Bug#27321: Wrong subquery result in a grouping select.
        Now the Item_field::fix_outer_field() uses Item_outer_field objects to
        represent aliased and non-aliased outer fields for grouping outer selects
        only.
      sql/item.h:
        Bug#27321: Wrong subquery result in a grouping select.
        The direct_ref and the found_in_select_list fields were added to the
        Item_outer_ref class.
      1cf3b965
  8. 27 Mar, 2007 1 commit
    • unknown's avatar
      Fixed bug #27348. · ec3de562
      unknown authored
      If a set function with a outer reference s(outer_ref) cannot be aggregated 
      the outer query against which the reference has been resolved then MySQL
      interpretes s(outer_ref) in the same way as it would interpret s(const).
      Hovever the standard requires throwing an error in this situation.
      Added some code to support this requirement in ansi mode.
      Corrected another minor bug in Item_sum::check_sum_func.
       
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #27348.
      mysql-test/t/subselect.test:
        Added a test case for bug #27348.
      sql/item_sum.cc:
        Fixed bug #27348.
        If a set function with a outer reference s(outer_ref) cannot be aggregated 
        the outer query against which the reference has been resolved then MySQL
        interprets s(outer_ref) in the same way as it would interpret s(const).
        Hovever the standard requires throwing an error in this situation.
        Added some code to support this requirement in ansi mode.
        Corrected another minor bug in Item_sum::check_sum_func.
      ec3de562
  9. 22 Mar, 2007 1 commit
    • unknown's avatar
      Fixed bug #27229: crash when a set function aggregated in outer · 1f8bdbe4
      unknown authored
      context was used as an argument of GROUP_CONCAT.
      Ensured correct setting of the depended_from field in references
      generated for set functions aggregated in outer selects.
      A wrong value of this field resulted in wrong maps returned by 
      used_tables() for these references.
      Made sure that a temporary table field is added for any set function
      aggregated in outer context when creation of a temporary table is 
      needed to execute the inner subquery. 
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #27229.
      mysql-test/t/subselect.test:
        Added a test case for bug #27229.
      sql/item.cc:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        Ensured correct setting of the depended_from field in references
        generated for set functions aggregated in outer selects.
      sql/item_sum.cc:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        Added the field aggr_sel to the objects of the class Item_sum.
        In any Item_sum object created for a set function this field 
        has to contain a pointer to the select where the set function
        is aggregated.
      sql/item_sum.h:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        Added the field aggr_sel to the objects of the class Item_sum.
        In any Item_sum object created for a set function this field 
        has to contain a pointer to the select where the set function
        is aggregated.
        Added a method that says whether a set function is aggregated
        in outer context and, if so, returns the aggregating select.
        Removed the field nest_level_tables_count introduced by the
        patch for bug 24484 as aggr_sel->join->tables contains the
        sane number.
      sql/sql_base.cc:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        Added the field aggr_sel to the objects of the class Item_sum.
        Removed changes introduced by the patch for bug 24484 as 
        the field leaf_count of the THD class is not used anymore.
      sql/sql_class.h:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        Added the field aggr_sel to the objects of the class Item_sum.
        Removed changes introduce by the patch for bug 24484 as 
        the field leaf_count of the THD class is not used anymore.
      sql/sql_insert.cc:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        Added the field aggr_sel to the objects of the class Item_sum.
        Removed changes introduce by the patch for bug 24484 as 
        the field leaf_count of the THD class is not used anymore.
      sql/sql_select.cc:
        Fixed bug #27229: crash when a set function aggregated in outer
        context was used as an argument of GROUP_CONCAT.
        When creating a temporary table a field is added in it for any 
        set function aggregated in outer context.
      1f8bdbe4
  10. 20 Mar, 2007 1 commit
    • unknown's avatar
      Fixed bug #27257: queries containing subqueries with COUNT(*) · 91f7f318
      unknown authored
      aggregated in outer context returned wrong results.
      This happened only if the subquery did not contain any references
      to outer fields.
      As there were no references to outer fields the subquery erroneously
      was taken for non-correlated one.
      Now any set function aggregated in outer context makes the subquery
      correlated.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #27257.
      mysql-test/t/subselect.test:
        Added a test case for bug #27257.
      91f7f318
  11. 12 Mar, 2007 1 commit
    • unknown's avatar
      Fixed bug #26738: incomplete string values in a result set column · 91abf15e
      unknown authored
      when the column is to be read from a derived table column which 
      was specified as a concatenation of string literals.
      The bug happened because the Item_string::append did not adjust the
      value of Item_string::max_length. As a result of it the temporary 
      table column  defined to store the concatenation of literals was 
      not wide enough to hold the whole value.
      
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #26738.
      mysql-test/t/subselect.test:
        Added a test case for bug #26738.
      91abf15e
  12. 09 Mar, 2007 1 commit
    • unknown's avatar
      Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized · 944030ae
      unknown authored
      away.
      
      Additional fix for bug#22331. Now Item_field prints its value in the case of
      the const field.
      
      
      mysql-test/r/varbinary.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/union.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/subselect.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/func_test.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/having.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/func_regexp.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/func_str.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/func_default.result:
        Corrected test case after fix for bug#22331.
      mysql-test/r/explain.result:
        Corrected test case after fix for bug#22331.
      sql/sql_union.cc:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        Cleanup of the SELECT_LEX::order_list list.
      sql/item.h:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        Added the print() member function to the Item_field class.
      sql/item.cc:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        Added the print() member function to the Item_field class.
      944030ae
  13. 07 Mar, 2007 1 commit
    • unknown's avatar
      Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized · 6de27791
      unknown authored
      away.
      
      During optimization stage the WHERE conditions can be changed or even
      be removed at all if they know for sure to be true of false. Thus they aren't
      showed in the EXPLAIN EXTENDED which prints conditions after optimization.
      
      Now if all elements of an Item_cond were removed this Item_cond is substituted
      for an Item_int with the int value of the Item_cond.
      If there were conditions that were totally optimized away then values of the
      saved cond_value and having_value will be printed instead.
      
      
      mysql-test/t/explain.test:
        Added a test case for the bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away.
      mysql-test/r/subselect.result:
        Corrected test case result after fix for bug#22331.
      mysql-test/r/func_test.result:
        Corrected test case result after fix for bug#22331.
      mysql-test/r/explain.result:
        Added a test case for the bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away.
      sql/sql_select.cc:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        Now if all elements of an Item_cond were removed this Item_cond is substituted
        for an Item_int with the int value of the Item_cond.
        If there were conditions that were totally optimized away then values of the
        saved cond_value and having_value will be printed instead.
      sql/sql_lex.h:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        The cond_value and the having_value variables are
        added to the SELECT_LEX class.
      sql/sql_lex.cc:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        The initialization of the cond_value and the having_value variables.
      sql/sql_select.h:
        Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
        away.
        Now having_value is also stored in the JOIN class.
      6de27791
  14. 01 Mar, 2007 1 commit
  15. 21 Feb, 2007 1 commit
    • unknown's avatar
      Bug#23800: Outer fields in correlated subqueries is used in a temporary table · f8855142
      unknown authored
      created for sorting.
      
      Any outer reference in a subquery was represented by an Item_field object.
      If the outer select employs a temporary table all such fields should be
      replaced with fields from that temporary table in order to point to the 
      actual data. This replacement wasn't done and that resulted in a wrong
      subquery evaluation and a wrong result of the whole query.
      
      Now any outer field is represented by two objects - Item_field placed in the
      outer select and Item_outer_ref in the subquery. Item_field object is
      processed as a normal field and the reference to it is saved in the
      ref_pointer_array. Thus the Item_outer_ref is always references the correct
      field. The original field is substituted for a reference in the
      Item_field::fix_outer_field() function.
      
      New function called fix_inner_refs() is added to fix fields referenced from
      inner selects and to fix references (Item_ref objects) to these fields.
      
      The new Item_outer_ref class is a descendant of the Item_direct_ref class.
      It additionally stores a reference to the original field and designed to
      behave more like a field.
      
      
      sql/item.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Now all outer fields are substituted with references to them (Item_outer_ref objects)
        in the Item_field::fix_outer_field() function.
        The original field is saved in the Item_outer_ref object.
      sql/item.h:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added the Item_outer_ref class.
      sql/mysql_priv.h:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added the fix_inner_refs() function prototype.
      sql/sql_delete.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added call to the fix_inner_refs() function.
      sql/sql_select.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        The new function called fix_inner_refs() is added.
      mysql-test/r/subselect.result:
        Added a test case for bug#23800: Correlated sub query returning incorrect results when
        operated upon.
      sql/sql_update.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added call to the fix_inner_refs() function.
      mysql-test/r/subselect3.result:
        Corrected test cases result after fix for bug#23800: Correlated sub query returning
        incorrect results when operated upon.
      mysql-test/t/subselect.test:
        Added a test case for bug#23800: Correlated sub query returning incorrect results when
        operated upon.
      sql/sql_lex.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added cleanup of the inner_refs_list.
      sql/sql_lex.h:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        The inner_refs_list is added to the SELECT_LEX class.
      f8855142
  16. 16 Feb, 2007 1 commit
  17. 30 Jan, 2007 1 commit
    • unknown's avatar
      Bug#21904 (parser problem when using IN with a double "(())") · a1e20e04
      unknown authored
      Before this fix, a IN predicate of the form: "IN (( subselect ))", with two
      parenthesis, would be evaluated as a single row subselect: if the subselect
      returns more that 1 row, the statement would fail.
      
      The SQL:2003 standard defines a special exception in the specification,
      and mandates that this particular form of IN predicate shall be equivalent
      to "IN ( subselect )", which involves a table subquery and works with more
      than 1 row.
      
      This fix implements "IN (( subselect ))", "IN ((( subselect )))" etc
      as per the SQL:2003 requirement.
      
      All the details related to the implementation of this change have been
      commented in the code, and the relevant sections of the SQL:2003 spec
      are given for reference, so they are not repeated here.
      
      Having access to the spec is a requirement to review in depth this patch.
      
      
      mysql-test/r/subselect.result:
        Implement IN predicate special exceptions with subselects.
      mysql-test/t/subselect.test:
        Implement IN predicate special exceptions with subselects.
      sql/item_subselect.cc:
        Implement IN predicate special exceptions with subselects.
      sql/item_subselect.h:
        Implement IN predicate special exceptions with subselects.
      sql/sql_yacc.yy:
        Implement IN predicate special exceptions with subselects, cleanup.
      a1e20e04
  18. 26 Jan, 2007 1 commit
    • unknown's avatar
      Fixed bug #24653. · da561a80
      unknown authored
      The bug report has demonstrated the following two problems.
      1. If an ORDER/GROUP BY list includes a constant expression being 
      optimized away and, at the same time, containing single-row
      subselects that return more that one row, no error is reported.
      Strictly speaking the standard allows to ignore error in this case.
      Yet, now a corresponding fatal error is reported in this case.
      2. If a query requires sorting by expressions containing single-row
      subselects that, however, return more than one row, then the execution
      of the query may cause a server crash. 
      To fix this some code has been added that blocks execution of a subselect
      item in case of a fatal error in the method Item_subselect::exec.
      
      
      mysql-test/r/subselect.result:
        Added a test cases for bug #24653.
      mysql-test/t/subselect.test:
        Added a test cases for bug #24653.
      sql/filesort.cc:
        Fixed bug #24653.
        Added a check for fatal error after reading the next row from the table
        in the function find_all_keys.
      sql/item.cc:
        Fixed bug #24653.
        Down-ported calculation of the attribute with_subselect of for Item objects.
      sql/item.h:
        Fixed bug #24653.
        Down-ported calculation of the attribute with_subselect of for Item objects.
      sql/item_cmpfunc.cc:
        Fixed bug #24653.
        Down-ported calculation of the attribute with_subselect of for Item objects.
      sql/item_cmpfunc.h:
        Fixed bug #24653.
        Down-ported calculation of the attribute with_subselect of for Item objects.
      sql/item_func.cc:
        Fixed bug #24653.
        Down-ported calculation of the attribute with_subselect of for Item objects.
      sql/item_subselect.cc:
        Fixed bug #24653.
        Added a check for fatal error in the method Item_subselect::exec
        to block evaluation of subselects in erroneous situations.
        Down-ported calculation of the attribute with_subselect of for Item objects.
      sql/sql_select.cc:
        Fixed bug #24653.
        Added a check to verify that any constant expression used
        in ORDER BY and/or GROUP BY lists which is optimized away
        does not contain subselects returning more than one row.
        If it does a fatal error is reported.
      da561a80
  19. 24 Jan, 2007 1 commit
  20. 19 Jan, 2007 1 commit
    • unknown's avatar
      Fixed bug #25219: crash for a query that contains an EXIST subquery with · edf72bf6
      unknown authored
      UNION over correlated and uncorrelated SELECTS.
      In such subqueries each uncorrelated SELECT should be considered as
      uncacheable. Otherwise join_free is called for it and in many cases
      it causes some problems.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #25219.
      mysql-test/t/subselect.test:
        Added a test case for bug #25219.
      sql/mysql_priv.h:
        Fixed bug #25219: crash for a query that contains an EXIST subquery with
        UNION over correlated and uncorrelated SELECTS.
        In such subqueries each uncorrelated SELECT should be considered as
        uncacheable. Otherwise join_free is called for it and in many cases
        it causes some problems. 
        Added a new flag UNCACHEABLE_UNITED for such SELECTs.
      sql/sql_lex.cc:
        Fixed bug #25219: crash for a query that contains an EXIST subquery with
        UNION over correlated and uncorrelated SELECTS.
        In such subqueries each uncorrelated SELECT should be considered as
        uncacheable. Otherwise join_free is called for it and in many cases
        it causes some problems.
        Added a new flag UNCACHEABLE_UNITED for such SELECTs.
      edf72bf6
  21. 18 Jan, 2007 1 commit
    • unknown's avatar
      Fixed bug #25580: incorrect stored representations of views in cases · af321686
      unknown authored
      when they contain the '!' operator.
      Added an implementation for the method Item_func_not::print. 
      The method encloses any NOT expression into extra parentheses to avoid
      incorrect stored representations of views that use the '!' operators.
      Without this change when a view was created that contained
      the expression !0*5  its stored representation contained not this
      expression but rather the expression not(0)*5 . 
      The operator '!' is of a higher precedence than '*', while NOT is 
      of a lower precedence than '*'. That's why the expression !0*5 
      is interpreted as not(0)*5, while the expression not(0)*5 is interpreted
      as not((0)*5) unless sql_mode is set to HIGH_NOT_PRECEDENCE.
      Now we translate !0*5 into (not(0))*5. 
      
      
      mysql-test/r/sp-code.result:
        Adjusted results after the fix of bug 25580.
      mysql-test/r/subselect.result:
        Adjusted results after the fix of bug 25580.
      mysql-test/r/view.result:
        Added a test case for bug #25580.
      mysql-test/t/view.test:
        Added a test case for bug #25580.
      sql/item_cmpfunc.cc:
        Fixed bug #25580: incorrect stored representations of views in cases
        when they contain the '!' operator.
        Added an implementation for the method Item_func_not::print. 
        The method encloses the NOT expression into extra parenthesis to avoid
        incorrect stored representations of views that use the '!' operators.
      sql/item_cmpfunc.h:
        Fixed bug #25580: incorrect stored representations of views in cases
        when they contain the '!' operator.
        Added an implementation for the method Item_func_not::print. 
        The method encloses the NOT expression into extra parenthesis to avoid
        incorrect stored representations of views that use the '!' operators.
      af321686
  22. 12 Jan, 2007 2 commits
    • unknown's avatar
      BUG#24127: (a,b) IN (SELECT c,d ...) can produce wrong results if a and/or b are NULLs: · 5f97dc6e
      unknown authored
      - Make the code produce correct result: use an array of triggers to turn on/off equalities for each
        compared column. Also turn on/off optimizations based on those equalities.
      - Make EXPLAIN output show "Full scan on NULL key" for tables for which we switch between
        ref/unique_subquery/index_subquery and ALL access.
      - index_subquery engine now has HAVING clause when it is needed, and it is
        displayed in EXPLAIN EXTENDED
      - Fix incorrect presense of "Using index" for index/unique-based subqueries (BUG#22930)
      // bk trigger note: this commit refers to BUG#24127
      
      
      mysql-test/r/ndb_subquery.result:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Updated test results (checked)
      mysql-test/r/subselect.result:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Updated test results (checked)
      mysql-test/r/subselect2.result:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Updated test results (checked)
      mysql-test/r/subselect3.result:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Testcases
      mysql-test/t/subselect3.test:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Testcases
      sql/item_cmpfunc.cc:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - For row-based IN subqueries, use one flag per each column. Set the flags appropriately before
          running the subquery.
      sql/item_cmpfunc.h:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
         - Added Item_func_trig_cond::get_triv_var()
      sql/item_subselect.cc:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Item_subselect::exec() and subselect_*_engine::exec() don't have parameter
          anymore - now Item_subselect owns the pushed down predicates guard flags.
        - A correct set of conditional predicates is now pushed into row-based IN 
          subquery.
        - select_indexsubquery_engine now has "HAVING clause" (needed for correct query
          results), and it is shown in EXPLAIN EXTENDED
      sql/item_subselect.h:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Item_subselect::exec() and subselect_*_engine::exec() don't have parameter
          anymore - now Item_subselect owns the pushed down predicates guard flags.
        - A correct set of conditional predicates is now pushed into row-based IN 
          subquery.
        - select_indexsubquery_engine now has "HAVING clause" (needed for correct query
          results), and it is shown in EXPLAIN EXTENDED
      sql/mysql_priv.h:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Added "in_having_cond" special Item name
      sql/mysqld.cc:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Added "in_having_cond" special Item name
      sql/sql_lex.h:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      sql/sql_select.cc:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Make "ref" analyzer be able to work with conditional equalities
        - Fix subquery optimization code to match the changes in what kinds of 
          conditions are pushed down into subqueries 
        - Fix wrong EXPLAIN output in some queries with subquery (BUG#22390)
      sql/sql_select.h:
        BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
        - Make "ref" analyzer be able to work with conditional equalities
        - Fix wrong EXPLAIN output in some queries with subquery (BUG#22390)
      5f97dc6e
    • unknown's avatar
      BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...) · b671815c
      unknown authored
      When transforming "oe IN (SELECT ie ...)" wrap the pushed-down predicates
      iff "oe can be null", not "ie can be null".
      The fix doesn't cover row-based subqueries, those will be fixed in #24127.
      
      
      mysql-test/r/subselect.result:
        BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
        Update the test results (checked)
      mysql-test/r/subselect3.result:
        BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
        - Testcase
      mysql-test/t/subselect3.test:
        BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
        - Testcase
      sql/item_subselect.cc:
        BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
        When transforming "oe IN (SELECT ie ...)" we should make special 
        provisions (wrap the pushed predicates) if we can encounter 
        NULL IN (SELECT ...), i.e. when oe->maybe_null. The code was checking
        for ie->maybe_null instead, fixed it for single value based subqueries.
        
        Row-based subqueries (e.g. (a,b) IN (SELECT c,d ...)) are not fixed 
        because they won't produce correct results for several other reasons 
        (filed as #24085)
      b671815c
  23. 12 Dec, 2006 1 commit
    • unknown's avatar
      Fixed bug #24670: optimizations that are legal only for subqueries without tables · 33446269
      unknown authored
      and no WHERE condition were applied for any subquery without tables.
      
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #24670.
      mysql-test/t/subselect.test:
        Added a test case for bug #24670.
      sql/item_subselect.cc:
        Fixed bug #24670: optimizations that are legal only for subqueries without tables
        and no WHERE condition were applied for any subquery without tables.
        
        Removed an assertion that caused an abort for subqueries without tables and no 
        WHERE condition. 
        Blocked substitution of a single-row subquery without tables for the constant 
        row from its select list when the subquery contained a WHERE condition.
        This optimization is valid only for subquries without tables with no conditions.
        Any subquery without tables with WHERE clause returns NULL if the WHERE condition
        is FALSE. Erroneously it was always considered as non-nullable that could trigger 
        another optimization concerning IS NULL predicates which is applicable only for 
        non-nullable expressions and ultimately led to a wrong result returned by the outer
        query.
        Added a proper implementation of the virtual method may_be_null for class 
        subselect_single_select_engine.
      sql/item_subselect.h:
        Fixed bug #24670: optimizations that are legal only for subqueries without tables
        and no WHERE condition were applied for any subquery without tables.
        Made method may_by_null for class subselect_engine vvirtual.
      33446269
  24. 07 Nov, 2006 1 commit
    • unknown's avatar
      Bug #11032: getObject() returns a String for a sub-query of type datetime · 5af4fd25
      unknown authored
       - When returning metadata for scalar subqueries the actual type of the
         column was calculated based on the value type, which limits the actual
         type of a scalar subselect to the set of (currently) 3 basic types : 
         integer, double precision or string. This is the reason that columns
         of types other then the basic ones (e.g. date/time) are reported as
         being of the corresponding basic type.
         Fixed by storing/returning information for the column type in addition
         to the result type.
      
      
      mysql-test/r/subselect.result:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - test case
      mysql-test/t/subselect.test:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - test case
      sql/item_subselect.cc:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - store and return the field type as well in addition to result type for 
           single row subqueries
      sql/item_subselect.h:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - store and return the field type as well in addition to result type for 
           single row subqueries
      5af4fd25
  25. 01 Nov, 2006 1 commit
    • unknown's avatar
      Fixed bug #21727. · 2a7cf59f
      unknown authored
      This is a performance issue for queries with subqueries evaluation
      of which requires filesort.
      Allocation of memory for the sort buffer at each evaluation of a
      subquery may take a significant amount of time if the buffer is rather big.
      With the fix we allocate the buffer at the first evaluation of the
      subquery and reuse it at each subsequent evaluation.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #21727.
      mysql-test/t/subselect.test:
        Added a test case for bug #21727.
      sql/item_subselect.h:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added an implementation for Item_subselect::is_uncacheable()
        returning TRUE if the engine if the subselect is uncacheable.
      sql/mysql_priv.h:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/records.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/sql_base.cc:
        Fixed bug #21727.
        Made sure that st_table::pos_in_table_list would be always initialized.
      sql/sql_select.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/sql_show.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/sql_table.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Cleanup.
      sql/table.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added st_table_list::in_subselect() returning for a table the subselect that 
        contains the FROM list this table is taken from (if there is any).
      sql/table.h:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added fields for sort_keys and buffpek buffers to the FILESORT_INFO structure.
      2a7cf59f
  26. 31 Oct, 2006 1 commit
    • unknown's avatar
      BUG#8804: wrong results for NULL IN (SELECT ...) · 48df3b96
      unknown authored
      Evaluate "NULL IN (SELECT ...)" in a special way: Disable pushed-down 
      conditions and their "consequences": 
       = Do full table scans instead of unique_[index_subquery] lookups.
       = Change appropriate "ref_or_null" accesses to full table scans in
         subquery's joins.
      Also cache value of NULL IN (SELECT ...) if the SELECT is not correlated 
      wrt any upper select.
      
      
      mysql-test/r/subselect.result:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
         - Updated test results
      sql/item.h:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
         - Added comments
      sql/item_cmpfunc.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
        Made Item_in_optimizer to:
        - cache the value of "NULL IN (uncorrelated select)"
        - Turn off pushed-down predicates when evaluating "NULL IN (SELECT ...)"
      sql/item_cmpfunc.h:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
        - Made Item_in_optimizer cache the value of "NULL IN (uncorrelated select)"
        - Added comments
      sql/item_subselect.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - When needed, wrap the predicates we push into subquery into an 
          Item_func_trig_cond so we're able to turn them off when evaluating 
          NULL IN (SELECT ...).
        - Added code to evaluate NULL IN (SELECT ...) in a special way:
          = In [unique_]index_subquery, do full table scan to see if there 
            are any rows.
          = For other subqueries, change ref[_or_null] to ALL if the
            ref[_or_null] was created from pushed-down predicate.
      sql/item_subselect.h:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added Item_subselect::is_correlated
        - Added comments
      sql/records.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Make rr_sequential() non-static
      sql/sql_lex.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added st_select_lex::is_correlated and Item_subselect::is_correlated.
      sql/sql_lex.h:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added st_select_lex::is_correlated
      sql/sql_select.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added KEY_FIELD::outer_ref to keep track of which ref accesses are 
          created from predicates that were pushed down into the subquery.
      sql/sql_select.h:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added KEYUSE::outer_ref
      mysql-test/r/subselect3.result:
        New BitKeeper file ``mysql-test/r/subselect3.result''
      mysql-test/t/subselect3.test:
        New BitKeeper file ``mysql-test/t/subselect3.test''
      48df3b96
  27. 20 Oct, 2006 1 commit
    • unknown's avatar
      Fixed bug #23478. · d649efbb
      unknown authored
      If elements a not top-level IN subquery were accessed by an index and 
      the subquery result set included  a NULL value then the quantified
      predicate that contained the subquery was evaluated to NULL when 
      it should return a non-null value.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #23478.
      mysql-test/t/subselect.test:
        Added a test case for bug #23478.
      d649efbb
  28. 17 Oct, 2006 1 commit
    • unknown's avatar
      Bug#21798: memory leak during query execution with subquery in column · 841ea461
      unknown authored
                  list using a function
      When executing dependent subqueries they are re-inited and re-exec() for 
      each row of the outer context.
      The cause for the bug is that during subquery reinitialization/re-execution,
      the optimizer reallocates JOIN::join_tab, JOIN::table in make_simple_join()
      and the local variable in 'sortorder' in create_sort_index(), which is
      allocated by make_unireg_sortorder().
      Care must be taken not to allocate anything into the thread's memory pool
      while re-initializing query plan structures between subquery re-executions.
      All such items mush be cached and reused because the thread's memory pool
      is freed at the end of the whole query.
      Note that they must be cached and reused even for queries that are not 
      otherwise cacheable because otherwise it will grow the thread's memory 
      pool every time a cacheable query is re-executed. 
      We provide additional members to the JOIN structure to store references 
      to the items that need to be cached.
      
      
      mysql-test/r/subselect.result:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - test case
      mysql-test/t/subselect.test:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - test case
      sql/mysql_priv.h:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the entities allocated in the threads memory pool by
           JOIN::exec ().
      sql/sql_delete.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_select.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_select.h:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_table.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_update.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      841ea461
  29. 16 Oct, 2006 1 commit
    • unknown's avatar
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on · ffc1facc
      unknown authored
                   strings
      MySQL is setting the flag HA_END_SPACE_KEYS for all the keys that reference
      text or varchar columns with collation different than binary.
      This was done to handle correctly the situation where a lookup on such a key
      may return more than 1 row because of the presence of many rows that differ
      only by the amount of trailing space in the table's string column.
      Inserting such values however appears to violate the unique checks on 
      INSERT/UPDATE. Thus that flag must not be set as it will prevent the optimizer
      from choosing a faster access method.
      This fix removes the setting of the HA_END_SPACE_KEYS flag.
      
      
      include/my_base.h:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - disabled HA_END_SPACE_KEY as it's no longer needed
      mysql-test/r/func_str.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - fixed explain in an existing case
      mysql-test/r/merge.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - fixed explain in an existing case
      mysql-test/r/select.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - test case
      mysql-test/r/subselect.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - fixed explain in an existing case
      mysql-test/t/select.test:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - test case
      ffc1facc
  30. 03 Oct, 2006 1 commit
    • unknown's avatar
      Update mysqltest to latest version · 9368c7bc
      unknown authored
       - ie. backport from 5.1
       - also update testcase error dected by new version
      
      
      mysql-test/include/show_msg.inc:
        BitKeeper file /home/msvensson/mysql/same_tools/my41-same_tools/mysql-test/include/show_msg.inc
      mysql-test/include/show_msg80.inc:
        BitKeeper file /home/msvensson/mysql/same_tools/my41-same_tools/mysql-test/include/show_msg80.inc
      BitKeeper/deleted/.del-rpl_chain_temp_table.test:
        Delete: mysql-test/t/rpl_chain_temp_table.test
      BitKeeper/deleted/.del-rpl_chain_temp_table.result:
        Delete: mysql-test/r/rpl_chain_temp_table.result
      BitKeeper/deleted/.del-rpl_failsafe.result:
        Delete: mysql-test/r/rpl_failsafe.result
      BitKeeper/deleted/.del-rpl_failsafe.test:
        Delete: mysql-test/t/rpl_failsafe.test
      BitKeeper/deleted/.del-rpl_heap.test:
        Delete: mysql-test/t/rpl_heap.test
      BitKeeper/deleted/.del-rpl_heap.result:
        Delete: mysql-test/r/rpl_heap.result
      BitKeeper/deleted/.del-rpl000018.result:
        Delete: mysql-test/r/rpl000018.result
      BitKeeper/deleted/.del-rpl000018.test:
        Delete: mysql-test/t/rpl000018.test
      client/Makefile.am:
        Link mysqltest with mysys/my_copy.c
      client/mysqltest.c:
        Update mysqltest to latest version
      mysql-test/include/have_multi_ndb.inc:
        Remove old syntax "@filename" in favor of "--require filename"
      mysql-test/include/master-slave.inc:
        Remove old syntax "@filename" in favor of "--require filename"
      mysql-test/include/ps_query.inc:
        Remove the comment about no output now when it does.
      mysql-test/r/check.result:
        Update output from --send
      mysql-test/r/connect.result:
        Update result file for connect test after backport form 5.1
      mysql-test/r/flush.result:
        Update output from --send
      mysql-test/r/flush_block_commit.result:
        Update output from --send
      mysql-test/r/func_misc.result:
        Update output from --send
      mysql-test/r/grant2.result:
        Update output from --send
      mysql-test/r/handler.result:
        Update output from --send
      mysql-test/r/kill.result:
        Update output from --send
      mysql-test/r/lock_multi.result:
        Update output from --send
      mysql-test/r/mix_innodb_myisam_binlog.result:
        Update output from --send
      mysql-test/r/mysqltest.result:
        Update mysqltest.result after backport
      mysql-test/r/ps_2myisam.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_3innodb.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_4heap.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_5merge.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_6bdb.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_7ndb.result:
        Update result as the output from query is now printed
      mysql-test/r/rename.result:
        Update output from --send
      mysql-test/r/rpl000001.result:
        Update output from --send
      mysql-test/r/rpl_error_ignored_table.result:
        Update output from --send
      mysql-test/r/rpl_master_pos_wait.result:
        Update output from --send
      mysql-test/r/subselect.result:
        Update result file after adding missing ;
      mysql-test/r/synchronization.result:
        Update output from --send
      mysql-test/r/type_blob.result:
        Update result file after adding missing ;
      mysql-test/t/connect.test:
        Backport test from 5.1
      mysql-test/t/init_file.test:
        Update test so something is printed
      mysql-test/t/mysql_client_test.test:
        Update test so result is sent to file and something is printed
      mysql-test/t/mysqltest.test:
        Backport latest mysqltest.test file
      mysql-test/t/ps.test:
        Move the --replace_column statement to just before the statetement it should replace
      mysql-test/t/ps_1general.test:
        Move the --replace_column statement to just before the statetement it should replace
      mysql-test/t/ps_grant.test:
        Remove the $DB, no other test uses it
      mysql-test/t/rpl_flush_tables.test:
        Fetch $SERVER_VERSION from the db server
      mysql-test/t/rpl_trunc_temp.test:
        Remove the selection of connection master after it's been disconnected already
      mysql-test/t/subselect.test:
        Add missing ;
      mysql-test/t/type_blob.test:
        Add missing ;
      9368c7bc
  31. 25 Sep, 2006 1 commit
    • unknown's avatar
      Fixed bug #21853: assert failure for a grouping query with · 9bf2ed95
      unknown authored
      an ALL/ANY quantified subquery in HAVING.
      The Item::split_sum_func2 method should not create Item_ref
      for objects of any class derived from Item_subselect.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #21853.
      mysql-test/t/subselect.test:
        Added a test case for bug #21853.
      9bf2ed95
  32. 18 Sep, 2006 1 commit
  33. 08 Sep, 2006 1 commit
    • unknown's avatar
      Bug #21540: Subqueries with no from and aggregate functions return · 2a00a073
      unknown authored
                  wrong results
       Mark the containing Item(s) (Item_subselect descendant usually) of 
       a subselect as containing aggregate functions if it has references
       to aggregates functions that are calculated outside its context.
       This tels end_send_group() not to make an Item_subselect descendant in
       select list a copy and causes the correct value being returned.
      
      
      mysql-test/r/func_group.result:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         - test cases
      mysql-test/r/subselect.result:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         - fixed the result of an existing testcase.
      mysql-test/t/subselect.test:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         - test cases
      sql/item_sum.cc:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         Mark the containing Item (Item_subselect descendant usually) of 
         a subselect as containing aggregate functions if it has references
         to aggregates functions that are calculated outside its context.
         This tels end_send_group() not to make an Item_subselect descendant in
         select list a copy and causes the correct value being returned.
      2a00a073
  34. 31 Aug, 2006 1 commit
    • unknown's avatar
      Bug#14654 : Cannot select from the same table twice within a UNION statement · c9bba13a
      unknown authored
       Made the parser to support parenthesis around UNION branches.
       This is done by amending the rules of the parser so it generates the correct
       structure.
       Currently it supports arbitrary subquery/join/parenthesis operations in the 
       EXISTS clause. 
       In the IN/scalar subquery case it will allow adding nested parenthesis only 
       if there is an UNION clause after the parenthesis. Otherwise it will just  
       treat the multiple nested parenthesis as a scalar expression.
       It adds extra lex level for ((SELECT ...) UNION ...) to accommodate for the
       UNION clause.
      
      
      mysql-test/r/subselect.result:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - test cases
      mysql-test/t/subselect.test:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - test cases
      sql/sql_yacc.yy:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - shuffle around the rules for the parenthesis in subselect
      c9bba13a
  35. 24 Aug, 2006 2 commits
    • unknown's avatar
      BUG#16255: Post-review fixes: adjust the testcase. · f895a16c
      unknown authored
      mysql-test/r/subselect.result:
        BUG#16255: A proper testcase
      mysql-test/t/subselect.test:
        BUG#16255: A proper testcase
      f895a16c
    • unknown's avatar
      Bug #16255: Subquery in WHERE (the cset by Georgi Kodinov) · c74c8195
      unknown authored
       Must not use Item_direct_ref in HAVING because it points to
       the new value (witch is not yet calculated for the first row).
      
      
      mysql-test/r/subselect.result:
        Bug #16255: Subquery in where
         - test case
      mysql-test/t/subselect.test:
        Bug #16255: Subquery in where
         - test case
      sql/item_subselect.cc:
        Bug #16255: Subquery in where
         Must not use Item_direct_ref in HAVING because it points to
         the new value (witch is not yet calculated for the first row).
      c74c8195
  36. 10 Aug, 2006 1 commit
    • unknown's avatar
      Bug #16792 query with subselect, join, and group not returning proper values · d3dd6fa0
      unknown authored
       Treat queries with no FROM and aggregate functions as normal queries,
      so the aggregate function get correctly calculated as if there is 1 row. 
      This means that they will be considered to have one row, so COUNT(*) will return
      1 instead of 0. Other aggregates will behave in compatible manner.
      
      
      mysql-test/r/func_gconcat.result:
        Bug #16792 query with subselect, join, and group not returning proper values
         - test case. Note how it improves the support for DUAL.
      mysql-test/r/func_group.result:
        Bug #16792 query with subselect, join, and group not returning proper values
         - test case. Note how it improves the support for DUAL.
      mysql-test/r/subselect.result:
        Bug #16792 query with subselect, join, and group not returning proper values
         - consequence of (SELECT MAX(<const>)) now returning <const> instead of 0
      mysql-test/t/func_group.test:
        Bug #16792 query with subselect, join, and group not returning proper values
         - test case.
      sql/opt_sum.cc:
        Bug #16792 query with subselect, join, and group not returning proper values
         - cannot do the optimization if the index is already opened by (say) UPDATE
           as it invloves opening reading and closing the index.
      sql/sql_select.cc:
        Bug #16792 query with subselect, join, and group not returning proper values
         - Treat queries with no FROM and aggregate functions as normal queries,
        so the aggregate function get correctly calculated as if there is 1 row.
      d3dd6fa0