Skip to content

Commit d3380a9

Browse files
author
Bernt M. Johnsen
committed
Merged from gca-branch (bug 42567)
2 parents adf6fc1 + a400289 commit d3380a9

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

mysql-test/r/group_by.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,3 +1691,15 @@ FROM t1;
16911691
ERROR 21000: Subquery returns more than 1 row
16921692
DROP TABLE t1;
16931693
SET @@sql_mode = @old_sql_mode;
1694+
SET @old_sql_mode = @@sql_mode;
1695+
SET @@sql_mode='ONLY_FULL_GROUP_BY';
1696+
CREATE TABLE t1(i INT);
1697+
INSERT INTO t1 VALUES (1), (10);
1698+
SELECT COUNT(i) FROM t1;
1699+
COUNT(i)
1700+
2
1701+
SELECT COUNT(i) FROM t1 WHERE i > 1;
1702+
COUNT(i)
1703+
1
1704+
DROP TABLE t1;
1705+
SET @@sql_mode = @old_sql_mode;

mysql-test/t/func_group.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ insert into t1 values (3,5,"C");
1818
insert into t1 values (3,6,"D");
1919

2020
# Test of MySQL field extension with and without matching records.
21+
#### Note: The two following statements may fail if the execution plan
22+
#### or optimizer is changed. The result for column c is undefined.
2123
select a,c,sum(a) from t1 group by a;
2224
select a,c,sum(a) from t1 where a > 10 group by a;
2325
select sum(a) from t1 where a > 10;

mysql-test/t/group_by.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,4 +1139,22 @@ DROP TABLE t1;
11391139
SET @@sql_mode = @old_sql_mode;
11401140

11411141

1142+
#
1143+
# Bug#42567 Invalid GROUP BY error
1144+
#
1145+
1146+
# Setup of the subtest
1147+
SET @old_sql_mode = @@sql_mode;
1148+
SET @@sql_mode='ONLY_FULL_GROUP_BY';
1149+
1150+
CREATE TABLE t1(i INT);
1151+
INSERT INTO t1 VALUES (1), (10);
1152+
1153+
# The actual test
1154+
SELECT COUNT(i) FROM t1;
1155+
SELECT COUNT(i) FROM t1 WHERE i > 1;
1156+
1157+
# Cleanup of subtest
1158+
DROP TABLE t1;
1159+
SET @@sql_mode = @old_sql_mode;
11421160

0 commit comments

Comments
 (0)