Bug #4103 max() function does not work in certains BDB Tables !!!
Submitted: 11 Jun 2004 11:22 Modified: 22 Jun 2004 12:41
Reporter: Santiago LLobet Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.20 OS:Linux (LINUX & WINDOWS)
Assigned to: CPU Architecture:Any

[11 Jun 2004 11:22] Santiago LLobet
Description:
When I run this query:
 
Select max(IdEncuestado) from apertura where IdSurvey='1';

On the table named 'apertura' (see below) I get the result='1' and not '10' wich is the correct answer.

If I run the same query WITHOUT the "WHERE" clause is does work !!!

  Yours Sincerely
  Santiago LLobet

How to repeat:
SCRIPT TO CREATE THE TABLE:
####################################################################
CREATE TABLE apertura (
  IdSurvey int(11) NOT NULL default '0',
  Fecha date default NULL,
  Hora time default NULL,
  IdEncuestado int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (IdSurvey,IdEncuestado)
) TYPE=BerkeleyDB;

INSERT INTO apertura VALUES("1", "2004-01-09", "11:00:40", "1");
INSERT INTO apertura VALUES("1", "2004-01-09", "11:22:04", "2");
INSERT INTO apertura VALUES("1", "2004-01-09", "11:00:41", "3");
INSERT INTO apertura VALUES("1", "2004-01-09", "12:19:29", "4");
INSERT INTO apertura VALUES("1", "2004-05-27", "18:43:29", "5");
INSERT INTO apertura VALUES("1", "2004-05-28", "08:20:48", "6");
INSERT INTO apertura VALUES("1", "2004-05-28", "09:08:04", "7");
INSERT INTO apertura VALUES("1", "2004-05-28", "09:05:05", "8");
INSERT INTO apertura VALUES("1", "2004-05-28", "00:08:19", "9");
INSERT INTO apertura VALUES("1", "2004-05-27", "20:21:20", "10");
#################################################################
[11 Jun 2004 15:37] Hartmut Holzgraefe
Tested with 4.0.20 on Linux without problems,
the result was always '10' as expected
[15 Jun 2004 18:14] Santiago LLobet
Please contact with me!!!(sllobet@rankdom.com)

  That bug is happening to me!!!! I wil give you an username and a Password for you to connect with my OWN database. (MySQL MAX 4.0.20 on LINUX Redhat Kernel 2.4.2-2) The same thing happens on a WIN2000 System !!!!

  I'm sure something wrong is happening that make fail such a simple query. !!

  Best Regards from Spain.
  Santiago LLobet
[22 Jun 2004 12:41] Sergei Golubchik
no, connecting to your database won't help :(

please try to create a small repeatable test case and post it here