[Pkg-mysql-commits] r1365 - in branches/experimental-5.0/debian: . patches
Norbert Tretkowski
nobse at alioth.debian.org
Thu Dec 11 08:43:52 UTC 2008
tags 505179 pending
tags 505181 pending
thanks
Author: nobse
Date: 2008-12-11 08:43:51 +0000 (Thu, 11 Dec 2008)
New Revision: 1365
Added:
branches/experimental-5.0/debian/patches/50_fix_agg_functions.dpatch
Modified:
branches/experimental-5.0/debian/changelog
Log:
New patch from 5.0.74 to fix check for non-aggregated columns in queries.
Modified: branches/experimental-5.0/debian/changelog
===================================================================
--- branches/experimental-5.0/debian/changelog 2008-12-05 21:40:29 UTC (rev 1364)
+++ branches/experimental-5.0/debian/changelog 2008-12-11 08:43:51 UTC (rev 1365)
@@ -1,5 +1,7 @@
mysql-dfsg-5.0 (5.0.67-2) UNRELEASED; urgency=low
+ * New patch from 5.0.74 to fix check for non-aggregated columns in queries.
+ (closes: #505179, #505181)
* Add patch from Dan Munckton:
+ Clearly indicate that we do not support running multiple instances
of mysqld by duplicating the init script.
@@ -8,7 +10,7 @@
file (/etc/mysql/my.cnf).
* Really fix FTBFS if build twice in a row. (closes: #442684)
- -- Norbert Tretkowski <nobse at debian.org> Thu, 04 Dec 2008 21:39:52 +0100
+ -- Norbert Tretkowski <nobse at debian.org> Thu, 11 Dec 2008 09:41:14 +0100
mysql-dfsg-5.0 (5.0.67-1) unstable; urgency=low
Added: branches/experimental-5.0/debian/patches/50_fix_agg_functions.dpatch
===================================================================
--- branches/experimental-5.0/debian/patches/50_fix_agg_functions.dpatch (rev 0)
+++ branches/experimental-5.0/debian/patches/50_fix_agg_functions.dpatch 2008-12-11 08:43:51 UTC (rev 1365)
@@ -0,0 +1,104 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 50_fix_agg_functions.dpatch by Norbert Tretkowski <nobse at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: http://bugs.mysql.com/bug.php?id=39656
+
+ at DPATCH@
+=== modified file 'mysql-test/r/func_group.result'
+--- a/mysql-test/r/func_group.result 2008-03-06 15:19:24 +0000
++++ b/mysql-test/r/func_group.result 2008-11-24 15:30:24 +0000
+@@ -1425,4 +1425,27 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) F
+ AVG(a) CAST(AVG(a) AS DECIMAL)
+ 15 15
+ DROP TABLE t1;
++CREATE TABLE t1 (a INT, b INT);
++INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
++SET SQL_MODE='ONLY_FULL_GROUP_BY';
++SELECT COUNT(*) FROM t1;
++COUNT(*)
++3
++SELECT COUNT(*) FROM t1 where a=1;
++COUNT(*)
++3
++SELECT COUNT(*),a FROM t1;
++ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
++SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
++COUNT(*)
++9
++SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
++FROM t1 outr;
++ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
++SELECT COUNT(*) FROM t1 a JOIN t1 outr
++ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
++COUNT(*)
++0
++SET SQL_MODE=default;
++DROP TABLE t1;
+ End of 5.0 tests
+
+=== modified file 'mysql-test/t/func_group.test'
+--- a/mysql-test/t/func_group.test 2008-03-06 15:19:24 +0000
++++ b/mysql-test/t/func_group.test 2008-11-24 15:30:24 +0000
+@@ -926,5 +926,34 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) F
+
+ DROP TABLE t1;
+
++#
++# Bug #39656: Behaviour different for agg functions with & without where -
++# ONLY_FULL_GROUP_BY
++#
++
++CREATE TABLE t1 (a INT, b INT);
++INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
++
++SET SQL_MODE='ONLY_FULL_GROUP_BY';
++
++SELECT COUNT(*) FROM t1;
++SELECT COUNT(*) FROM t1 where a=1;
++
++--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
++SELECT COUNT(*),a FROM t1;
++
++SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
++
++--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
++SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
++ FROM t1 outr;
++
++SELECT COUNT(*) FROM t1 a JOIN t1 outr
++ ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
++
++SET SQL_MODE=default;
++DROP TABLE t1;
++
++
+ ###
+ --echo End of 5.0 tests
+
+=== modified file 'sql/sql_select.cc'
+--- a/sql/sql_select.cc 2008-11-03 09:50:09 +0000
++++ b/sql/sql_select.cc 2008-11-24 15:30:24 +0000
+@@ -390,11 +390,21 @@ inline int setup_without_group(THD *thd,
+ {
+ int res;
+ nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
++ /*
++ Need to save the value, so we can turn off only the new NON_AGG_FIELD
++ additions coming from the WHERE
++ */
++ uint8 saved_flag= thd->lex->current_select->full_group_by_flag;
+ DBUG_ENTER("setup_without_group");
+
+ thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
+ res= setup_conds(thd, tables, leaves, conds);
+
++ /* it's not wrong to have non-aggregated columns in a WHERE */
++ if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
++ thd->lex->current_select->full_group_by_flag= saved_flag |
++ (thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED);
++
+ thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
+ res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
+ order);
+
More information about the Pkg-mysql-commits
mailing list