diff options
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | mysql-test/r/heap.result | 10 | ||||
-rw-r--r-- | mysql-test/t/heap.test | 14 | ||||
-rw-r--r-- | sql/opt_sum.cc | 1 |
4 files changed, 26 insertions, 0 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 7a3063c3884..d2413d7a4dc 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -5,6 +5,7 @@ Administrator@fred. Greg@greg-laptop. Miguel@light.local Sinisa@sinisa.nasamreza.org +acurtis@pcgem.rdg.cyberkinetica.com ahlentz@co3064164-a.rochd1.qld.optusnet.com.au akishkin@work.mysql.com antony@ltantony.dsl-verizon.net diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index bdf7dc225f3..11958f0a619 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -217,3 +217,13 @@ DELETE from t1 where a < 100; SELECT * from t1; a DROP TABLE t1; +CREATE TABLE `job_titles` ( +`job_title_id` int(6) unsigned NOT NULL default '0', +`job_title` char(18) NOT NULL default '', +PRIMARY KEY (`job_title_id`), +UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`) +) TYPE=HEAP; +SELECT MAX(job_title_id) FROM job_titles; +MAX(job_title_id) +NULL +DROP TABLE job_titles; diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index b2de58ca083..87518798a36 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -147,3 +147,17 @@ INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11); DELETE from t1 where a < 100; SELECT * from t1; DROP TABLE t1; + +# +# Bug#4411 Server hangs when trying to SELECT MAX(id) from an empty HEAP table +# +CREATE TABLE `job_titles` ( + `job_title_id` int(6) unsigned NOT NULL default '0', + `job_title` char(18) NOT NULL default '', + PRIMARY KEY (`job_title_id`), + UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`) +) TYPE=HEAP; + +SELECT MAX(job_title_id) FROM job_titles; + +DROP TABLE job_titles; diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index b5eec2d5dd4..0831c375f7a 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -401,6 +401,7 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond) /* Can't use this key, for looking up min() or max(), end if last one */ if (key == 1) return 0; + key>>=1; idx++; } ref->key_length=0; ref->key=idx; |