mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.0
into c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.0
This commit is contained in:
commit
a34ca4bf81
4 changed files with 58 additions and 4 deletions
|
@ -80,7 +80,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
|
||||||
custom_arg.search_flag= SEARCH_SAME;
|
custom_arg.search_flag= SEARCH_SAME;
|
||||||
old_allocated= keyinfo->rb_tree.allocated;
|
old_allocated= keyinfo->rb_tree.allocated;
|
||||||
res= tree_delete(&keyinfo->rb_tree, info->recbuf, &custom_arg);
|
res= tree_delete(&keyinfo->rb_tree, info->recbuf, &custom_arg);
|
||||||
info->s->index_length+= (keyinfo->rb_tree.allocated-old_allocated);
|
info->s->index_length-= (old_allocated - keyinfo->rb_tree.allocated);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,6 +464,46 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
||||||
html prod
|
html prod
|
||||||
1 0.0000
|
1 0.0000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||||
|
SELECT DISTINCT a, 1 FROM t1;
|
||||||
|
a 1
|
||||||
|
1 1
|
||||||
|
2 1
|
||||||
|
3 1
|
||||||
|
4 1
|
||||||
|
5 1
|
||||||
|
SELECT DISTINCT 1, a FROM t1;
|
||||||
|
1 a
|
||||||
|
1 1
|
||||||
|
1 2
|
||||||
|
1 3
|
||||||
|
1 4
|
||||||
|
1 5
|
||||||
|
CREATE TABLE t2 (a int, b int);
|
||||||
|
INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
|
||||||
|
SELECT DISTINCT a, b, 2 FROM t2;
|
||||||
|
a b 2
|
||||||
|
1 1 2
|
||||||
|
2 2 2
|
||||||
|
2 3 2
|
||||||
|
2 4 2
|
||||||
|
3 5 2
|
||||||
|
SELECT DISTINCT 2, a, b FROM t2;
|
||||||
|
2 a b
|
||||||
|
2 1 1
|
||||||
|
2 2 2
|
||||||
|
2 2 3
|
||||||
|
2 2 4
|
||||||
|
2 3 5
|
||||||
|
SELECT DISTINCT a, 2, b FROM t2;
|
||||||
|
a 2 b
|
||||||
|
1 2 1
|
||||||
|
2 2 2
|
||||||
|
2 2 3
|
||||||
|
2 2 4
|
||||||
|
3 2 5
|
||||||
|
DROP TABLE t1,t2;
|
||||||
create table t1 (id int, dsc varchar(50));
|
create table t1 (id int, dsc varchar(50));
|
||||||
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||||
select distinct id, IFNULL(dsc, '-') from t1;
|
select distinct id, IFNULL(dsc, '-') from t1;
|
||||||
|
|
|
@ -334,6 +334,22 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
# Test cases for #12625: DISTINCT for a list with constants
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||||
|
SELECT DISTINCT a, 1 FROM t1;
|
||||||
|
SELECT DISTINCT 1, a FROM t1;
|
||||||
|
|
||||||
|
CREATE TABLE t2 (a int, b int);
|
||||||
|
INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
|
||||||
|
SELECT DISTINCT a, b, 2 FROM t2;
|
||||||
|
SELECT DISTINCT 2, a, b FROM t2;
|
||||||
|
SELECT DISTINCT a, 2, b FROM t2;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
# Bug 9784 DISTINCT IFNULL truncates data
|
# Bug 9784 DISTINCT IFNULL truncates data
|
||||||
#
|
#
|
||||||
create table t1 (id int, dsc varchar(50));
|
create table t1 (id int, dsc varchar(50));
|
||||||
|
|
|
@ -12229,9 +12229,7 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
|
||||||
li.rewind();
|
li.rewind();
|
||||||
while ((item=li++))
|
while ((item=li++))
|
||||||
{
|
{
|
||||||
if (item->const_item() || item->with_sum_func)
|
if (!item->const_item() && !item->with_sum_func && !item->marker)
|
||||||
continue;
|
|
||||||
if (!item->marker)
|
|
||||||
{
|
{
|
||||||
ORDER *ord=(ORDER*) thd->calloc(sizeof(ORDER));
|
ORDER *ord=(ORDER*) thd->calloc(sizeof(ORDER));
|
||||||
if (!ord)
|
if (!ord)
|
||||||
|
|
Loading…
Add table
Reference in a new issue