summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-12-21 10:56:40 +0200
committerunknown <monty@mashka.mysql.fi>2002-12-21 10:56:40 +0200
commit62c7449a5594972f5e940bfdf8785a70f82af82c (patch)
treead383628b0de0a338b83b72a5c8832d3177b18af
parent23362b5cae7acbe00b64980802e8e5e7f9480f7d (diff)
parent5f1b9717c53f19ef4f7a5206f59a7678a025dbe2 (diff)
downloadmariadb-git-62c7449a5594972f5e940bfdf8785a70f82af82c.tar.gz
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())
-rw-r--r--innobase/btr/btr0sea.c7
-rw-r--r--mysql-test/r/case.result4
-rw-r--r--mysql-test/t/case.test5
-rw-r--r--sql/ha_innodb.cc9
-rw-r--r--sql/item_cmpfunc.cc3
-rw-r--r--sql/sql_db.cc2
6 files changed, 23 insertions, 7 deletions
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index cef3a4e4b38..31f001ee769 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -453,8 +453,6 @@ btr_search_info_update_slow(
}
if (build_index) {
- ut_a(block->n_fields + block->n_bytes > 0);
-
btr_search_build_page_hash_index(block->frame,
block->n_fields,
block->n_bytes,
@@ -1028,7 +1026,10 @@ btr_search_build_page_hash_index(
return;
}
- ut_a(n_fields + n_bytes > 0);
+ if (n_fields + n_bytes == 0) {
+
+ return;
+ }
/* Calculate and cache fold values and corresponding records into
an array for fast insertion to the hash index */
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index ec37c9a5763..183e2692d7a 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -63,3 +63,7 @@ nothing 2
one 1
two 1
drop table t1;
+color
+orange
+yellow
+green
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 79511f5f546..f2b8d42e07c 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -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;
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index b11c31f1d23..dd718f02ba9 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -1238,7 +1238,14 @@ ha_innobase::open(
if (primary_key != MAX_KEY) {
fprintf(stderr,
"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)
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 0e7d38ecda8..a36c96ffea4 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -727,8 +727,9 @@ String *Item_func_case::val_str(String *str)
null_value=1;
return 0;
}
+ null_value= 0;
if (!(res=item->val_str(str)))
- null_value=1;
+ null_value= 1;
return res;
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index cde0c6cc31f..e805cf74f19 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -383,8 +383,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_length=db_length;
thd->db_access=db_access;