Commit graph

121 commits

Author SHA1 Message Date
Michael Widenius
139a2b64bf Merge with 5.2 2011-03-09 15:47:59 +02:00
Sergey Petrunya
959bf3c1ee Bug #46680: Assertion failed in file item_subselect.cc, line 305 crashing on HAVING subquery
- Backport the testcase (the fix itself was included with the subquery optimizations backport)
2010-12-25 16:23:16 +03:00
Sergey Glukhov
9870e24482 test case fix 2010-12-21 15:30:07 +03:00
Sergey Glukhov
e2db8e6ccb Bug#58030 crash in Item_func_geometry_from_text::val_str
Item_sum_max/Item_sum_min incorrectly set null_value flag and
attempt to get result in parent functions leads to crash.
This happens due to double evaluation of the function argumet.
First evaluation happens in the comparator and second one
happens in Item_cache::cache_value().
The fix is to introduce new Item_cache object which
holds result of the argument and use this cached value
as an argument of the comparator.

mysql-test/r/func_group.result:
  test case
mysql-test/t/func_group.test:
  test case
sql/item.cc:
  added assertion that ether we have some result or result is NULL.
sql/item_sum.cc:
  introduce new Item_cache object which
  holds result of the argument and use this cached value
  as an argument of the comparator.
sql/item_sum.h:
  introduce new Item_cache object which
  holds result of the argument and use this cached value
  as an argument of the comparator.
2010-12-21 14:34:11 +03:00
Alexey Kopytov
d7d0f6390b Bug #54465: assert: field_types == 0 || field_types[field_pos]
== MYSQL_TYPE_LONGLONG

A MIN/MAX() function with a subquery as its argument could lead
to a debug assertion on debug builds or wrong data on release
ones.

The problem was a combination of the following factors:

- Item_sum_hybrid::fix_fields() might use the argument
(args[0]) to calculate 'hybrid_field_type' which was later used
to decide how the data should be sent to the client.

- Item_sum::make_field() might use the argument again to
calculate the field's type when sending result set metadata to
the client.

- The argument could be changed in between these two calls via
  Item::set_arg() leading to inconsistent metadata being
  reported.

Here is what was happening for the bug's test case:

1. Item_sum_hybrid::fix_fields() calculates hybrid_field_type
as MYSQL_TYPE_LONGLONG based on args[0] which is an
Item::SUBSELECT_ITEM at that time.

2. A temporary table is created to execute the
query. create_tmp_field_from_item() creates a Field_long object
according to the subselect's max_length.

3. The subselect item in Item_sum_hybrid is replaced by the
Item_field object referencing the newly created Field_long.

4. Item_sum::make_field() rightfully returns the
MYSQL_TYPE_LONG type when calculating the result set metadata.

5. When sending the actual data, Item::send() relies on the
virtual field_type() function which in our case returns
previously calculated hybrid_field_type == MYSQL_TYPE_LONGLONG.

It looks like the only solution is to never refer to the
argument's metadata after the result metadata has been
calculated in fix_fields(), since the argument itself may be
different by then. In this sense, Item_sum::make_field() should
never be used, because it may rely on the argument's metadata
and is only called after fix_fields(). The "default"
implementation in Item::make_field() should be used instead as
it relies only on field_type(), but not on the argument's type.

Fixed by removing Item_sum::make_field() so that the superclass
implementation Item::make_field() is always used.

mysql-test/r/func_group.result:
  Added a test case for bug #54465.
mysql-test/t/func_group.test:
  Added a test case for bug #54465.
sql/item_sum.cc:
  Removed Item_sum::make_field() so that the superclass
  implementation Item::make_field() is always used.
sql/item_sum.h:
  Removed Item_sum::make_field() so that the superclass
  implementation Item::make_field() is always used.
2010-08-27 13:44:35 +04:00
Evgeny Potemkin
9f638f535e Manual merge of the fix for bug#43668. 2009-11-24 18:26:13 +03:00
Evgeny Potemkin
bc43bff7ed Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
MySQL manual describes values of the YEAR(2) field type as follows:
values 00 - 69 mean 2000 - 2069 years and values 70 - 99 mean 1970 - 1999
years. MIN/MAX and comparison functions was comparing them as int values
thus producing wrong result.

Now the Arg_comparator class is extended with compare_year function which
performs correct comparison of the YEAR type.
The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
correctly calculate its value.
To allow Arg_comparator to use func_name() function for Item_func and Item_sum
objects the func_name declaration is moved to the Item_result_field class.
A helper function is_owner_equal_func is added to the Arg_comparator class.
It checks whether the Arg_comparator object owner is the <=> function or not.
A helper function setup is added to the Item_sum_hybrid class. It sets up
cache item and comparator.

mysql-test/r/func_group.result:
  Added a test case for the bug#43668.
mysql-test/t/func_group.test:
  Added a test case for the bug#43668.
sql/item.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Now Item_cache_int returns the type of cached item.
sql/item.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  To allow Arg_comparator to use func_name() function for Item_func and Item_sum
  objects the func_name declaration is moved to the Item_result_field class.
sql/item_cmpfunc.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Arg_comparator class is extended with compare_year function which
  performs correct comparison of the YEAR type.
sql/item_cmpfunc.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The year_as_datetime variable is added to the Arg_comparator class.
  It's set to TRUE when YEAR value should be converted to the
  YYYY-00-00 00:00:00 format for correct YEAR-DATETIME comparison.
sql/item_geofunc.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Item_func_spatial_rel::val_int chenged to use Arg_comparator's string
  buffers.
sql/item_subselect.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Added an implementation of the virtual func_name function.
sql/item_sum.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
  correctly calculate its value.
  A helper function setup is added to the Item_sum_hybrid class. It sets up
  cache item and comparator.
sql/item_sum.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
  correctly calculate its value.
  Added an implementation of the virtual func_name function.
2009-11-17 17:06:46 +03:00
Jorgen Loland
6da93b223b Bug#47280 - strange results from count(*) with order by multiple
columns without where/group
                     
Simple SELECT with implicit grouping used to return many rows if
the query was ordered by the aggregated column in the SELECT
list. This was incorrect because queries with implicit grouping
should only return a single record.
                              
The problem was that when JOIN:exec() decided if execution needed
to handle grouping, it was assumed that sum_func_count==0 meant
that there were no aggregate functions in the query. This
assumption was not correct in JOIN::exec() because the aggregate
functions might have been optimized away during JOIN::optimize().
                  
The reason why queries without ordering behaved correctly was
that sum_func_count is only recalculated if the optimizer chooses
to use temporary tables (which it does in the ordered case).
Hence, non-ordered queries were correctly treated as grouped.
                  
The fix for this bug was to remove the assumption that
sum_func_count==0 means that there is no need for grouping. This
was done by introducing variable "bool implicit_grouping" in the
JOIN object.

mysql-test/r/func_group.result:
  Add test for BUG#47280
mysql-test/t/func_group.test:
  Add test for BUG#47280
sql/opt_sum.cc:
  Improve comment for opt_sum_query()
sql/sql_class.h:
  Add comment for variables in TMP_TABLE_PARAM
sql/sql_select.cc:
  Introduce and use variable implicit_grouping instead of (!group_list && sum_func_count) in places that need to test if grouping is required. Also added comments for: optimization of aggregate fields for implicitly grouped queries  (JOIN::optimize) and choice of end_select method (JOIN::execute)
sql/sql_select.h:
  Add variable implicit_grouping, which will be TRUE for queries that contain aggregate functions but no GROUP BY clause. Also added comment to sort_and_group variable.
2009-10-14 10:46:50 +02:00
Bernt M. Johnsen
2cca1991bd Prepared for push (BUG#42567) 2009-02-26 18:17:06 +01:00
Georgi Kodinov
f31d305238 merged bug 39656 to 5.1-bugteam 2008-11-24 18:00:09 +02:00
Georgi Kodinov
d795963cba Bug #39656: Behaviour different for agg functions with & without where -
ONLY_FULL_GROUP_BY

The check for non-aggregated columns in queries with aggregate function, but without
GROUP BY was treating all the parts of the query as if they are in the SELECT list.
Fixed by ignoring the non-aggregated fields in the WHERE clause.

mysql-test/r/func_group.result:
  Bug #39656: test case
mysql-test/t/func_group.test:
  Bug #39656: test case
sql/sql_select.cc:
  Bug #39656: ignore the new non-aggregated column refs in a WHERE
  by saving the state so far and then adding only the new values of the other
  parts of the bitmask.
2008-11-24 17:30:47 +02:00
Georgi Kodinov
a18639b634 Bug #37348: Crash in or immediately after JOIN::make_sum_func_list
The optimizer pulls up aggregate functions which should be aggregated in
an outer select. At some point it may substitute such a function for a field
in the temporary table. The setup_copy_fields function doesn't take this
into account and may overrun the copy_field buffer.
      
Fixed by filtering out the fields referenced through the specialized
reference for aggregates (Item_aggregate_ref).
Added an assertion to make sure bugs that cause similar discrepancy 
don't go undetected.

mysql-test/r/func_group.result:
  Bug #37348: test case
mysql-test/t/func_group.test:
  Bug #37348: test case
sql/item.cc:
  Bug #37348: Added a way to distinguish Item_aggregate_ref from the other types of refs
sql/item.h:
  Bug #37348: Added a way to distinguish Item_aggregate_ref from the other types of refs
sql/sql_select.cc:
  Bug #37348: 
   - Don't consider copying field references
      seen through Item_aggregate_ref
   - check for discrepancies between the number of expected 
     fields that need copying and the actual fields copied.
2008-10-02 17:44:49 +03:00
unknown
e829d36367 Merge kaamos.(none):/data/src/opt/bug34512/my50
into  kaamos.(none):/data/src/opt/bug34512/my51


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item_sum.cc:
  Auto merged
2008-03-19 14:25:36 +03:00
unknown
8270d9875f Fix for bug #34512: CAST( AVG( double ) AS DECIMAL )
returns wrong results

Casting AVG() to DECIMAL led to incorrect results when the arguments
had a non-DECIMAL type, because in this case
Item_sum_avg::val_decimal() performed the division by the number of
arguments twice.

Fixed by changing Item_sum_avg::val_decimal() to not rely on
Item_sum_sum::val_decimal(), i.e. calculate sum and divide using
DECIMAL arithmetics for DECIMAL arguments, and utilize val_real() with
subsequent conversion to DECIMAL otherwise.


mysql-test/r/func_group.result:
  Added a test case for bug #34512.
mysql-test/t/func_group.test:
  Added a test case for bug #34512.
sql/item_sum.cc:
  Do not use Item_sum_sum::val_decimal() in Item_sum_avg::val_decimal()
  because the first one, depending on the arguments type, may return
  either the sum of the arguments, or the average calculated by the
  virtual val_real() method of Item_sum_avg. Instead, do our own
  calculation based on the arguments type.
2008-03-06 18:19:47 +03:00
unknown
e2584c9fa0 Merge macbook.gmz:/Users/kgeorge/mysql/work/B33133-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B33133-5.1-opt


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/sql_base.cc:
  Auto merged
2008-01-09 17:10:09 +02:00
unknown
06b68454ea Bug #33133: Views are not transparent
When resolving references we need to take into consideration
the view "fields" and allow qualified access to them.
Fixed by extending the reference resolution to process view
fields correctly.


mysql-test/r/func_group.result:
  Bug #33133: test case
mysql-test/t/func_group.test:
  Bug #33133: test case
sql/sql_base.cc:
  Bug #33133: allow qualified alias refs to view fields
2008-01-09 16:49:13 +02:00
unknown
4cb4a53eb4 Merge magare.gmz:/home/kgeorge/mysql/work/B31794-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B31794-5.1-opt


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
2007-11-01 18:49:45 +02:00
unknown
660eb5bb40 Bug #31794: no syntax error on SELECT id FROM t HAVING count(*)>2
The HAVING clause is subject to the same rules as the SELECT list
about using aggregated and non-aggregated columns.
But this was not enforced when processing implicit grouping from
using aggregate functions.
Fixed by performing the same checks for HAVING as for SELECT.


mysql-test/r/func_group.result:
  Bug #31794: test case
mysql-test/t/func_group.test:
  Bug #31794: test case
sql/sql_select.cc:
  Bug #31794: Check HAVING in addition to SELECT list
2007-11-01 18:36:24 +02:00
unknown
ee8ab6d9e6 Merge magare.gmz:/home/kgeorge/mysql/work/B30715-merged-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B30715-merged-5.1-opt


mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/type_decimal.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
mysql-test/t/type_decimal.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/opt_sum.cc:
  merge bug 30715 to 5.1-opt
2007-10-24 11:50:09 +03:00
unknown
e2433cbcaa Bug #30715: Assertion failed: item_field->field->real_maybe_null(),
file .\opt_sum.cc, line
The optimizer pre-calculates the MIN/MAX values for queries like
 SELECT MIN(kp_k) WHERE kp_1 = const AND ... AND kp_k-1 = const
when there is a key over kp_1...kp_k
In doing so it was not checking correctly nullability and 
there was a superfluous assert(). 
Fixed by making sure that the field can be null before checking and
taking out the wrong assert().
.
Introduced a correct check for nullability 
The MIN(field) can return NULL when all the row values in the group
are NULL-able or if there were no rows.
Fixed the assertion to reflect the case when there are no rows.


mysql-test/r/func_group.result:
  Bug #30715: test case
mysql-test/t/func_group.test:
  Bug #30715: test case
sql/opt_sum.cc:
  Bug #30715: correct nullability check for MIN/MAX pre-calculation over index.
2007-10-24 11:15:08 +03:00
unknown
c62aa5c795 Merge magare.gmz:/home/kgeorge/mysql/autopush/B31156-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B31156-5.1-opt


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
2007-10-13 09:22:37 +03:00
unknown
6736d404a0 Bug #31156: mysqld: item_sum.cc:918: virtual bool
Item_sum_distinct::setup(THD*): Assertion

There was an assertion to detect a bug in ROLLUP
implementation. However the assertion is not true
when used in a subquery context with non-cacheable
statements.
Fixed by turning the assertion to accepted case
(just like it's done for the other aggregate functions). 


mysql-test/r/func_group.result:
  Bug #31156: test case
mysql-test/t/func_group.test:
  Bug #31156: test case
sql/item_sum.cc:
  Bug #31156: make it OK to call setup() several times:
   done for (e.g.) scalar subquery
2007-10-08 12:57:43 +03:00
unknown
e0d006f348 Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/include/mix1.inc:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
mysql-test/r/ps.result:
  merging
mysql-test/r/subselect.result:
  merging
mysql-test/r/type_datetime.result:
  SCCS merged
mysql-test/t/ps.test:
  merging
mysql-test/t/subselect.test:
  merging
mysql-test/t/type_datetime.test:
  merging
sql/opt_sum.cc:
  SCCS merged
2007-05-18 20:00:49 +05:00
unknown
418a2983c0 Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/5.0o-bug27573


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  bug#27573: hand merged test case
2007-05-16 12:22:20 +03:00
unknown
aaf6acae9b Bug#27573: MIN() on an indexed column which is always NULL sets _other_ results
to NULL

For queries of the form SELECT MIN(key_part_k) FROM t1 
WHERE key_part_1 = const and ... and key_part_k-1 = const,
the opt_sum_query optimization tries to
use an index to substitute MIN/MAX functions with their values according
to the following rules:
1) Insert the minimum non-null values where the WHERE clause still matches, or
3) A row of nulls

However, the correct semantics requires that there is a third case 2)
such that a NULL value is substituted if there are only NULL values for 
key_part_k.

The patch modifies opt_sum_query() to handle this missing case.


mysql-test/r/func_group.result:
  Bug #27573: Correct result
mysql-test/t/func_group.test:
  Bug #27573: test case
sql/opt_sum.cc:
  Bug #27573:
  Added code that will try to read the
  first non-null value for a given complete-field prefix, second
  choice is to read the null, and lastly set the error code if no row
  is found.
2007-05-15 15:29:12 +03:00
unknown
02ab4503dc Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/51


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
2007-03-29 13:29:45 +02:00
unknown
9683b0ae68 Merge mysql.com:/home/ram/work/mysql-5.0-maint
into  mysql.com:/home/ram/work/b21976/my50-b21976


sql/item.h:
  Auto merged
mysql-test/r/func_group.result:
  merging
mysql-test/t/func_group.test:
  merging
sql/item_sum.cc:
  merging
2007-03-29 13:37:07 +05:00
unknown
66196e5511 Merge mysql.com:/home/ram/work/b21976/my50-b21976
into  mysql.com:/home/ram/work/b21976/my51-b21976


sql/item.h:
  Auto merged
mysql-test/r/func_group.result:
  merging
mysql-test/t/func_group.test:
  merging
sql/item_sum.cc:
  merging
2007-03-29 12:04:02 +05:00
unknown
cded2b70d6 Merge mysql.com:/home/ram/work/b25834/b25834.5.0
into  mysql.com:/home/ram/work/b25834/b25834.5.1


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
2007-02-28 14:37:09 +04:00
unknown
9bbd385a89 Fix for bug #25834: Test failure in "func_group"
Round the results of std() for some calls with double arguments
to avoid double math precision problems.
2007-02-27 11:01:58 +04:00
unknown
e87d593ae1 Merge siva.hindu.god:/usr/home/tim/m/bk/50
into  siva.hindu.god:/usr/home/tim/m/bk/51


BitKeeper/etc/collapsed:
  auto-union
mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
2006-12-26 12:43:57 -07:00
unknown
1fdda68914 In func_group.test, round the results of std() for some calls, because Windows' sqrt() function appears to return fewer "significant" digits than the Unix implementations.
This is for bug #22555.


mysql-test/r/func_group.result:
  Round the results of std() for some calls, because Windows' sqrt() function appears to return fewer "significant" digits than the Unix implementations.
  This is for bug #22555.
mysql-test/t/func_group.test:
  Round the results of std() for some calls, because Windows' sqrt() function appears to return fewer "significant" digits than the Unix implementations.
  This is for bug #22555.
2006-12-26 12:42:54 -07:00
unknown
7e84939ef6 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug22555/my51-bug22555
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint


BitKeeper/etc/collapsed:
  auto-union
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
mysql-test/r/func_group.result:
  Manual merge.
mysql-test/t/func_group.test:
  Manual merge.
2006-12-22 16:05:59 -05:00
unknown
01e98327df Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug22555/my50-bug22555
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint


BitKeeper/etc/collapsed:
  auto-union
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
mysql-test/r/func_group.result:
  Manual merge.
mysql-test/t/func_group.test:
  Manual merge.
2006-12-22 16:02:54 -05:00
unknown
4dcf4cb981 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug22555/my50-bug22555
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug22555/my51-bug22555


BitKeeper/etc/collapsed:
  auto-union
mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_sum.cc:
  Manual merge.
2006-12-22 15:59:10 -05:00
unknown
82bd9b6b61 Bug#22555: STDDEV yields positive result for groups with only one row
When only one row was present, the subtraction of nearly the same number 
resulted in catastropic cancellation, introducing an error in the 
VARIANCE calculation near 1e-15.  That was sqrt()ed to get STDDEV, the 
error was escallated to near 1e-8.  

The simple fix of testing for a row count of 1 and forcing that to yield 
0.0 is insufficient, as two rows of the same value should also have a
variance of 0.0, yet the error would be about the same.

So, this patch changes the formula that computes the VARIANCE to be one
that is not subject to catastrophic cancellation.

In addition, it now uses only (faster-than-decimal) floating point numbers
to calculate, and renders that to other types on demand.


mysql-test/r/func_group.result:
  Test that the bug is fixed, and that no unexpected behavior arises from the 
  changes.
mysql-test/t/func_group.test:
  Test that the bug is fixed, and that no unexpected behavior arises from the 
  changes.
sql/item_sum.cc:
  Serg's suggestion: Force all VARIANCE calculations to be done with floating-
  point types.  It's faster, and the SQL standard says we may implement these
  functions any way we want.
  
  Additionally, use a form of variance calculation that is not subject to 
  catastrophic cancellation.   
  http://static.flickr.com/108/311308512_5c4e1c0c3d_b.jpg
sql/item_sum.h:
  Remove unused members and add a comment describing the recurrence relation.
2006-12-22 15:37:37 -05:00
unknown
c872b005e2 Fix for bug #21976: Unnecessary warning with count(decimal)
We use val_int() calls (followed by null_value check) to determine 
nullness in some Item_sum_count' and Item_sum_count_distinct' methods, 
as a side effect we get extra warnings raised in the val_int().
Fix: use is_null() instead.


mysql-test/r/func_group.result:
  Fix for bug #21976: Unnecessary warning with count(decimal)
    - test result.
mysql-test/t/func_group.test:
  Fix for bug #21976: Unnecessary warning with count(decimal)
    - test case.
sql/item.h:
  Fix for bug #21976: Unnecessary warning with count(decimal)
    - comment adjusted.
sql/item_sum.cc:
  Fix for bug #21976: Unnecessary warning with count(decimal)
    - use is_null() to determine nullness.
2006-12-22 09:29:28 +04:00
unknown
cdc86ac126 Merge dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.0-opt
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.1-opt


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
2006-11-30 17:59:14 +01:00
unknown
140c3ee961 func_group.test, func_group.result, func_gconcat.result, func_gconcat.test:
merge fix : removed undeterministic warnings


mysql-test/r/func_gconcat.result:
  merge fix : removed undeterministic warnings
mysql-test/r/func_group.result:
  merge fix : removed undeterministic warnings
mysql-test/t/func_gconcat.test:
  merge fix : removed undeterministic warnings
mysql-test/t/func_group.test:
  merge fix : removed undeterministic warnings
2006-11-30 18:47:59 +02:00
unknown
90d14d50a9 Merge mysql.com:/home/hf/work/mysql-5.0.clean
into  mysql.com:/home/hf/work/mysql-5.1.clean


include/my_time.h:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/gis-rtree.result:
  Auto merged
mysql-test/r/order_by.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
mysql-test/t/gis-rtree.test:
  Auto merged
mysql-test/t/type_datetime.test:
  Auto merged
mysql-test/t/udf.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/my_decimal.cc:
  Auto merged
sql/my_decimal.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/records.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/type_newdecimal.result:
  SCCS merged
mysql-test/t/type_newdecimal.test:
  merging
sql/item.cc:
  merging
sql/item_subselect.cc:
  SCCS merged
sql/item_timefunc.h:
  merging
sql/sql_lex.cc:
  SCCS merged
sql/sql_select.h:
  merging
2006-11-08 19:09:39 +04:00
unknown
634d3991ab Bug #23184: SELECT causes server crash
Item::val_xxx() may be called by the server several times at execute time 
 for a single query. Calls to val_xxx() may be very expensive and sometimes
 (count(distinct), sum(distinct), avg(distinct)) not possible.
 To avoid that problem the results of calculation for these aggregate 
 functions are cached so that val_xxx() methods just return the calculated 
 value for the second and subsequent calls.


mysql-test/r/func_group.result:
  Bug #23184: SELECT causes server crash
   - test case
mysql-test/t/func_group.test:
  Bug #23184: SELECT causes server crash
   - test case
sql/item_sum.cc:
  Bug #23184: SELECT causes server crash
   - caching of the aggregate function results so no need to recalculate at val_xxx()
sql/item_sum.h:
  Bug #23184: SELECT causes server crash
   - caching of the aggregate function results so no need to recalculate at val_xxx()
2006-10-31 11:01:27 +02:00
unknown
5222b59093 Merge dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/func_str.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/heap_hash.result:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/olap.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/range.result:
  Auto merged
mysql-test/r/row.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/type_date.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/r/view_grant.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
mysql-test/t/func_str.test:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/opt_sum.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_list.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/t/sp.test:
  SCCS merged
sql/item_cmpfunc.cc:
  SCCS merged
sql/sql_select.cc:
  SCCS merged
2006-09-18 12:57:20 +02:00
unknown
2aeec864e2 Merge macbook.gmz:/Users/kgeorge/mysql/work/B16792-4.1-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B16792-5.0-opt


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
sql/opt_sum.cc:
  Auto merged
mysql-test/r/func_group.result:
  merge 4.1->5.0 for bug #16792
mysql-test/t/func_group.test:
  merge 4.1->5.0 for bug #16792
sql/sql_select.cc:
  merge 4.1->5.0 for bug #16792
2006-09-05 17:09:12 +03:00
unknown
f68085c4e7 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge


BitKeeper/etc/ignore:
  auto-union
BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921:
  Auto merged
BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56:
  Auto merged
BitKeeper/deleted/.del-mysys.dsp~32695fee91189326:
  Auto merged
BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833:
  Auto merged
BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048:
  Auto merged
BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f:
  Auto merged
client/mysql.cc:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
client/mysqlcheck.c:
  Auto merged
client/mysqldump.c:
  Auto merged
client/mysqltest.c:
  Auto merged
dbug/dbug.c:
  Auto merged
extra/perror.c:
  Auto merged
extra/yassl/src/yassl_imp.cpp:
  Auto merged
extra/yassl/src/yassl_int.cpp:
  Auto merged
include/mysql.h:
  Auto merged
include/mysql_com.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
mysql-test/r/cast.result:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/federated.result:
  Auto merged
mysql-test/r/func_compress.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/gis-rtree.result:
  Auto merged
mysql-test/r/gis.result:
  Auto merged
mysql-test/r/im_daemon_life_cycle.result:
  Auto merged
mysql-test/r/im_utils.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/mysqlcheck.result:
  Auto merged
mysql-test/r/rpl_sp.result:
  Auto merged
mysql-test/r/rpl_trigger.result:
  Auto merged
mysql-test/r/sp-code.result:
  Auto merged
mysql-test/r/sp-security.result:
  Auto merged
mysql-test/r/strict.result:
  Auto merged
mysql-test/r/type_blob.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/r/type_ranges.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/r/user_var.result:
  Auto merged
mysql-test/t/cast.test:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/im_daemon_life_cycle.imtest:
  Auto merged
mysql-test/t/im_life_cycle.imtest:
  Auto merged
mysql-test/t/im_utils.imtest:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
mysql-test/t/mysqlbinlog.test:
  Auto merged
mysql-test/t/mysqlcheck.test:
  Auto merged
mysql-test/t/ps.test:
  Auto merged
mysql-test/t/rpl_trigger.test:
  Auto merged
mysql-test/t/sp-security.test:
  Auto merged
mysql-test/t/strict.test:
  Auto merged
mysql-test/t/udf.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_udf.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/table.h:
  Auto merged
storage/ndb/src/kernel/error/ndbd_exit_codes.c:
  Auto merged
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
mysql-test/r/im_life_cycle.result:
  e
  use local
mysql-test/r/ps.result:
  use local
client/Makefile.am:
  Manual merge.
client/mysqlimport.c:
  Manual merge.
configure.in:
  Manual merge.
mysql-test/mysql-test-run.pl:
  Manual merge.
mysql-test/r/mysqldump.result:
  Manual merge.
mysql-test/r/mysqltest.result:
  Manual merge.
mysql-test/r/ndb_basic.result:
  Manual merge.
mysql-test/r/rpl_view.result:
  Manual merge.
mysql-test/r/show_check.result:
  Manual merge.
mysql-test/r/sp-error.result:
  Manual merge.
mysql-test/r/sp.result:
  Manual merge.
mysql-test/r/union.result:
  Manual merge.
mysql-test/t/mysqldump.test:
  Manual merge.
mysql-test/t/mysqltest.test:
  Manual merge.
mysql-test/t/ndb_basic.test:
  Manual merge.
mysql-test/t/rpl_sp.test:
  Manual merge.
mysql-test/t/rpl_view.test:
  Manual merge.
mysql-test/t/show_check.test:
  Manual merge.
mysql-test/t/sp-error.test:
  Manual merge.
mysql-test/t/sp.test:
  Manual merge.
sql/item_sum.cc:
  Manual merge.
sql/mysql_priv.h:
  Manual merge.
sql/sp_head.cc:
  Manual merge.
sql/sql_db.cc:
  Manual merge.
sql/sql_delete.cc:
  Manual merge.
sql/sql_lex.h:
  Manual merge.
sql/sql_show.cc:
  Manual merge.
sql/sql_table.cc:
  Manual merge.
sql/sql_trigger.cc:
  Manual merge.
sql/sql_yacc.yy:
  Manual merge.
tests/mysql_client_test.c:
  Manual merge.
2006-08-12 21:06:51 +04:00
unknown
d3dd6fa008 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. 
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.
2006-08-10 16:45:02 +03:00
unknown
ed44a2ee51 Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/t/union.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/func_group.result:
  Merge manually
mysql-test/t/func_group.test:
  Merge manually
2006-08-03 09:32:58 +02:00
unknown
ddb91478e8 Merge sunlight.local:/local_work/tmp_merge-5.0-opt-mysql
into  sunlight.local:/local_work/tmp_merge-5.1-opt-mysql


client/mysql.cc:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/func_str.result:
  Auto merged
mysql-test/r/group_min_max.result:
  Auto merged
BitKeeper/deleted/.del-make_win_src_distribution.sh~f80d8fca44e4e5f1:
  Auto merged
BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56:
  Auto merged
BitKeeper/deleted/.del-mysqld_ia64.dsp~7f8cf84d81ee04e2:
  Auto merged
BitKeeper/deleted/.del-mysqldump.dsp~a8bd23547d3fc27e:
  Auto merged
BitKeeper/deleted/.del-mysqldump_ia64.dsp~a2aabe898be35b31:
  Auto merged
mysql-test/r/innodb.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/ps_7ndb.result:
  Auto merged
mysql-test/r/type_ranges.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/date_formats.test:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
mysql-test/t/group_min_max.test:
  Auto merged
mysql-test/t/innodb.test:
  Auto merged
mysql-test/t/innodb_mysql.test:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_subselect.h:
  Auto merged
sql/opt_range.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/time.cc:
  Auto merged
storage/ndb/test/ndbapi/Makefile.am:
  Auto merged
strings/decimal.c:
  Auto merged
mysql-test/r/analyse.result:
  Manual merge
mysql-test/r/bigint.result:
  Manual merge
mysql-test/r/create.result:
  Manual merge
mysql-test/r/information_schema.result:
  Manual merge
mysql-test/r/ps_2myisam.result:
  Manual merge
mysql-test/r/ps_3innodb.result:
  Manual merge
mysql-test/r/ps_4heap.result:
  Manual merge
mysql-test/r/ps_5merge.result:
  Manual merge
mysql-test/r/ps_6bdb.result:
  Manual merge
mysql-test/r/rpl_insert_id.result:
  Manual merge
mysql-test/r/select.result:
  Manual merge
mysql-test/r/sp.result:
  Manual merge
mysql-test/r/subselect.result:
  Manual merge
mysql-test/t/information_schema.test:
  Manual merge
mysql-test/t/rpl_insert_id.test:
  Manual merge
sql/field.h:
  Manual merge
sql/item.cc:
  Manual merge
sql/item.h:
  Manual merge
sql/item_strfunc.h:
  Manual merge
sql/item_sum.cc:
  Manual merge
sql/mysql_priv.h:
  Manual merge
sql/share/errmsg.txt:
  Manual merge
sql/sql_class.h:
  Manual merge
sql/sql_select.cc:
  Manual merge
2006-07-30 00:33:24 +04:00
unknown
774300afe4 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/usr/home/ram/work/5.0.b10966


mysql-test/r/func_group.result:
  Auto merged
mysql-test/t/func_group.test:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
2006-07-23 12:58:26 +05:00
unknown
8024aabb76 Bug #20868: Client connection is broken on SQL query error
An aggregate function reference was resolved incorrectly and
caused a crash in count_field_types.
 Must use real_item() to get to the real Item instance through
the reference


mysql-test/r/func_group.result:
  Bug #20868: Client connection is broken on SQL query error
   * test case for the bug
mysql-test/t/func_group.test:
  Bug #20868: Client connection is broken on SQL query error
   * test case for the bug
sql/sql_select.cc:
  Bug #20868: Client connection is broken on SQL query error
   * correctly resolve aggregate function references.
2006-07-21 17:59:52 +03:00
unknown
30de4903ae Merge zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new-maint


BUILD/compile-dist:
  Auto merged
BitKeeper/deleted/.del-partition_innodb.result:
  Auto merged
BitKeeper/deleted/.del-partition_innodb.test:
  Auto merged
client/mysqltest.c:
  Auto merged
mysql-test/r/create.result:
  Auto merged
mysql-test/r/create_not_windows.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/partition.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/innodb_mysql.test:
  Auto merged
mysql-test/t/partition.test:
  Auto merged
mysql-test/t/ps_1general.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/wait_timeout.test:
  Auto merged
mysys/my_lib.c:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/unireg.cc:
  Auto merged
mysql-test/extra/rpl_tests/rpl_log.test:
  manuakl merge
mysql-test/lib/mtr_process.pl:
  manuakl merge
mysql-test/mysql-test-run.pl:
  manuakl merge
mysql-test/r/type_newdecimal.result:
  manuakl merge
mysql-test/t/create.test:
  manuakl merge
mysql-test/t/func_group.test:
  manuakl merge
mysql-test/t/type_newdecimal.test:
  manuakl merge
2006-07-05 16:16:09 -04:00