mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
fix for a bug in CASE ...WHEN ...
This commit is contained in:
parent
c2f3ff6630
commit
8ebc983442
4 changed files with 11 additions and 2 deletions
|
@ -40,3 +40,7 @@ fcase count(*)
|
|||
nothing 2
|
||||
one 1
|
||||
two 1
|
||||
color
|
||||
orange
|
||||
yellow
|
||||
green
|
||||
|
|
|
@ -30,3 +30,8 @@ insert into t1 values(1),(2),(3),(4);
|
|||
select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
|
||||
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
|
||||
drop table t1;
|
||||
drop table if exists t;
|
||||
create table t1 (row int not null, col int not null, val varchar(255) not null);
|
||||
insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small');
|
||||
select max(case col when 1 then val else null end) as color from t1 group by row;
|
||||
drop table if exists t;
|
||||
|
|
|
@ -687,6 +687,8 @@ String *Item_func_case::val_str(String *str)
|
|||
}
|
||||
if (!(res=item->val_str(str)))
|
||||
null_value=1;
|
||||
else
|
||||
null_value=item->null_value;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -371,8 +371,6 @@ bool mysql_change_db(THD *thd,const char *name)
|
|||
}
|
||||
send_ok(&thd->net);
|
||||
x_free(thd->db);
|
||||
if (lower_case_table_names)
|
||||
casedn_str(dbname);
|
||||
thd->db=dbname;
|
||||
thd->db_access=db_access;
|
||||
DBUG_RETURN(0);
|
||||
|
|
Loading…
Add table
Reference in a new issue