Commit c5f78752 authored by unknown's avatar unknown

Manual merge


BitKeeper/etc/ignore:
  auto-union
mysql-test/t/bool.test:
  Auto merged
mysql-test/t/cast.test:
  Auto merged
mysql-test/t/func_concat.test:
  Auto merged
mysql-test/t/grant.test:
  Auto merged
mysql-test/t/grant_cache.test:
  Auto merged
mysql-test/t/innodb-deadlock.test:
  Auto merged
mysql-test/t/loaddata.test:
  Auto merged
mysql-test/t/lowercase_table.test:
  Auto merged
mysql-test/t/lowercase_table3.test:
  Auto merged
mysql-test/t/mix_innodb_myisam_binlog.test:
  Auto merged
mysql-test/t/mysqlbinlog.test:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/rpl_EE_error.test:
  Auto merged
mysql-test/t/rpl_change_master.test:
  Auto merged
mysql-test/t/rpl_empty_master_crash.test:
  Auto merged
BitKeeper/deleted/.del-isam.test~834fb0ee8196c445:
  Auto merged
BitKeeper/deleted/.del-rpl_trunc_binlog.test~961b1f6ac73d37c8:
  Auto merged
mysql-test/r/flush_block_commit.result:
  Auto merged
mysql-test/r/flush_table.result:
  Auto merged
mysql-test/r/lock_multi.result:
  Auto merged
mysql-test/r/rpl_server_id1.result:
  Auto merged
mysql-test/r/rpl_server_id2.result:
  Auto merged
mysql-test/r/rpl_start_stop_slave.result:
  Auto merged
mysql-test/t/create_select_tmp.test:
  Auto merged
mysql-test/t/ctype_latin1_de.test:
  Auto merged
mysql-test/t/flush_block_commit.test:
  Auto merged
mysql-test/t/func_if.test:
  Auto merged
mysql-test/t/innodb-lock.test:
  Auto merged
mysql-test/t/lock_multi.test:
  Auto merged
mysql-test/t/rpl_drop.test:
  Auto merged
mysql-test/t/rpl_error_ignored_table.test:
  Auto merged
mysql-test/t/rpl_flush_log_loop.test:
  Auto merged
mysql-test/t/rpl_get_lock.test:
  Auto merged
mysql-test/t/rpl_heap.test:
  Auto merged
mysql-test/t/rpl_insert_id.test:
  Auto merged
mysql-test/t/rpl_loaddata.test:
  Auto merged
mysql-test/t/rpl_loaddata_rule_m.test:
  Auto merged
mysql-test/t/rpl_loaddata_rule_s.test:
  Auto merged
mysql-test/t/rpl_loaddatalocal.test:
  Auto merged
mysql-test/t/rpl_max_relay_size.test:
  Auto merged
mysql-test/t/rpl_reset_slave.test:
  Auto merged
mysql-test/t/system_mysql_db.test:
  Auto merged
mysql-test/t/system_mysql_db_fix.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/t/rpl_server_id2.test:
  Auto merged
parents bb20af75 4805236e
......@@ -580,6 +580,18 @@ a LENGTH(a) COUNT(*)
2 1 1
NULL NULL 2
DROP TABLE t1;
create table t1 ( a varchar(9), b int );
insert into t1 values('a',1),(null,2);
select a, max(b) from t1 group by a with rollup;
a max(b)
NULL 2
a 1
NULL 2
select distinct a, max(b) from t1 group by a with rollup;
a max(b)
NULL 2
a 1
drop table t1;
CREATE TABLE t1(id int, type char(1));
INSERT INTO t1 VALUES
(1,"A"),(2,"C"),(3,"A"),(4,"A"),(5,"B"),
......
......@@ -274,6 +274,15 @@ SELECT * FROM (SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
DROP TABLE t1;
#
# Bug #12887 Distinct is not always applied after rollup
#
create table t1 ( a varchar(9), b int );
insert into t1 values('a',1),(null,2);
select a, max(b) from t1 group by a with rollup;
select distinct a, max(b) from t1 group by a with rollup;
drop table t1;
# End of 4.1 tests
#
......@@ -309,3 +318,4 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
# End of 4.1 tests
......@@ -755,7 +755,7 @@ JOIN::optimize()
}
if (group_list || tmp_table_param.sum_func_count)
{
if (! hidden_group_fields)
if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
select_distinct=0;
}
else if (select_distinct && tables - const_tables == 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment