summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2013-09-15 17:30:53 -0700
committerIgor Babaev <igor@askmonty.org>2013-09-15 17:30:53 -0700
commitb8af3bd4d6b6bd92f8bf4eec132118a12483915c (patch)
treebc40f04872fea0a0ab1d95f9bd4c959f3eb1e8a2
parenta784d62dae58642fedf6e909102850ccdfe93431 (diff)
parent996f6194c69b556e37a143a6a175e60a9f57ab47 (diff)
downloadmariadb-git-b8af3bd4d6b6bd92f8bf4eec132118a12483915c.tar.gz
Merge 5.3->5.5
-rw-r--r--mysql-test/r/func_group.result13
-rw-r--r--mysql-test/t/func_group.test20
-rw-r--r--sql/sql_select.cc3
3 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index ba90707ca40..9049589b6db 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2126,6 +2126,19 @@ select z from (select count(*) as z from t1) v group by 1;
z
4
drop table t1;
+CREATE TABLE t1 (i1 int, INDEX(i1));
+INSERT INTO t1 VALUES (9),(8);
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (8),(4);
+CREATE TABLE t3 (i3 int, INDEX(i3));
+INSERT INTO t3 VALUES (9),(8);
+SELECT MAX(t3.i3) FROM t3, t2, t1 WHERE t1.i1 = t2.i2 AND ( 0 OR t3.i3 = t2.i2 );
+MAX(t3.i3)
+8
+SELECT MAX(t3.i3) FROM t3, t2, t1 WHERE t1.i1 = t2.i2 AND t3.i3 = t2.i2;
+MAX(t3.i3)
+8
+DROP TABLE t1,t2,t3;
# end of 5.3 tests
#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index a5c35c0dff2..0c2f28ab25d 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1403,6 +1403,26 @@ select z from (select count(*) as z from t1) v;
select z from (select count(*) as z from t1) v group by 1;
drop table t1;
+#
+# Bug mdev-5015: Degenerate OR condition in an aggregated join
+#
+
+CREATE TABLE t1 (i1 int, INDEX(i1));
+INSERT INTO t1 VALUES (9),(8);
+
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (8),(4);
+
+
+CREATE TABLE t3 (i3 int, INDEX(i3));
+INSERT INTO t3 VALUES (9),(8);
+
+SELECT MAX(t3.i3) FROM t3, t2, t1 WHERE t1.i1 = t2.i2 AND ( 0 OR t3.i3 = t2.i2 );
+
+SELECT MAX(t3.i3) FROM t3, t2, t1 WHERE t1.i1 = t2.i2 AND t3.i3 = t2.i2;
+
+DROP TABLE t1,t2,t3;
+
--echo # end of 5.3 tests
--echo #
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b5ecaecda89..c1ab91249a4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13874,7 +13874,8 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
{
if (!(cond= internal_remove_eq_conds(thd, cond, cond_value)))
return cond;
- }
+ }
+ should_fix_fields= 1;
}
if (should_fix_fields)
cond->update_used_tables();