Commit 62c7449a authored by unknown's avatar unknown

Merge with 3.23:

Remove duplicate casedn_str() in mysql_change_db()
Fix for null handling in CASE


innobase/btr/btr0sea.c:
  Auto merged
mysql-test/t/case.test:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
mysql-test/r/case.result:
  merge with 3.23
sql/sql_db.cc:
  Merge with 3.23 (to remove duplicate casedn_str())
parents 23362b5c 5f1b9717
...@@ -453,8 +453,6 @@ btr_search_info_update_slow( ...@@ -453,8 +453,6 @@ btr_search_info_update_slow(
} }
if (build_index) { if (build_index) {
ut_a(block->n_fields + block->n_bytes > 0);
btr_search_build_page_hash_index(block->frame, btr_search_build_page_hash_index(block->frame,
block->n_fields, block->n_fields,
block->n_bytes, block->n_bytes,
...@@ -1028,7 +1026,10 @@ btr_search_build_page_hash_index( ...@@ -1028,7 +1026,10 @@ btr_search_build_page_hash_index(
return; return;
} }
ut_a(n_fields + n_bytes > 0); if (n_fields + n_bytes == 0) {
return;
}
/* Calculate and cache fold values and corresponding records into /* Calculate and cache fold values and corresponding records into
an array for fast insertion to the hash index */ an array for fast insertion to the hash index */
......
...@@ -63,3 +63,7 @@ nothing 2 ...@@ -63,3 +63,7 @@ nothing 2
one 1 one 1
two 1 two 1
drop table t1; drop table t1;
color
orange
yellow
green
...@@ -30,3 +30,8 @@ insert into t1 values(1),(2),(3),(4); ...@@ -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 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; 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 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;
...@@ -1238,7 +1238,14 @@ ha_innobase::open( ...@@ -1238,7 +1238,14 @@ ha_innobase::open(
if (primary_key != MAX_KEY) { if (primary_key != MAX_KEY) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: table %s has no primary key in InnoDB\n" "InnoDB: Error: table %s has no primary key in InnoDB\n"
"InnoDB: data dictionary, but has one in MySQL!\n", name); "InnoDB: data dictionary, but has one in MySQL!\n"
"InnoDB: If you created the table with a MySQL\n"
"InnoDB: version < 3.23.54 and did not define a primary\n"
"InnoDB: key, but defined a unique key with all non-NULL\n"
"InnoDB: columns, then MySQL internally treats that key\n"
"InnoDB: as the primary key. You can fix this error by\n"
"InnoDB: dump + DROP + CREATE + reimport of the table.\n",
name);
} }
((row_prebuilt_t*)innobase_prebuilt) ((row_prebuilt_t*)innobase_prebuilt)
......
...@@ -727,8 +727,9 @@ String *Item_func_case::val_str(String *str) ...@@ -727,8 +727,9 @@ String *Item_func_case::val_str(String *str)
null_value=1; null_value=1;
return 0; return 0;
} }
null_value= 0;
if (!(res=item->val_str(str))) if (!(res=item->val_str(str)))
null_value=1; null_value= 1;
return res; return res;
} }
......
...@@ -383,8 +383,6 @@ bool mysql_change_db(THD *thd,const char *name) ...@@ -383,8 +383,6 @@ bool mysql_change_db(THD *thd,const char *name)
} }
send_ok(&thd->net); send_ok(&thd->net);
x_free(thd->db); x_free(thd->db);
if (lower_case_table_names)
casedn_str(dbname);
thd->db=dbname; thd->db=dbname;
thd->db_length=db_length; thd->db_length=db_length;
thd->db_access=db_access; thd->db_access=db_access;
......
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