List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:November 24 1999 12:58am
Subject:Re: Bug in min() function
View as plain text  
>>>>> "Frank" == Frank Oellien
> <Frank.Oellien@stripped> writes:

Frank> Michael Widenius wrote:
>> 
>> Hi!
>> 
>> Any way you can reproduce a table, that you can give us access to,
>> that shows this on Linux with the 3.22.26 version ?
>> 
>> If yes, please make a tar of the .frm, .ISM and .ISD files and this
>> mail and ftp it to ftp://www.mysql.com/pub/mysql/secret
>> and we will check this out.
>> 
>> Regards,
>> Monty

Frank> I have put the tables into your secret folder - mysql_min_bug.tar.gz

Frank> Try this command

mysql> select min(logGI50) from gi50;
Frank> +--------------+
Frank> | min(logGI50) |
Frank> +--------------+
Frank> |       -0.000 |
Frank> +--------------+
Frank> 1 row in set (0.00 sec)

Frank> With regards

Hi!

I have now fixed this case in MyISAM and ISAM in MySQL 3.23.7 and in ISAM in
for MySQL 3.22.28.

Here is a patch for the ISAM library:

*** /my/monty/master/mysql-3.23.6-alpha/isam/_search.c	Wed Nov 10 14:38:18 1999
--- ./_search.c	Wed Nov 24 02:52:05 1999
***************
*** 470,480 ****
        b+= sizeof(double);
        break;
      case HA_KEYTYPE_NUM:				/* Numeric key */
        if (keyseg->base.flag & HA_SPACE_PACK)
        {
  	int alength,blength;
  
! 	if (keyseg->base.flag & HA_REVERSE_SORT)
  	  swap(uchar*,a,b);
  	alength= *a++; blength= *b++;
  	if ((flag=(int) (keyseg->base.length-key_length)) < 0)
--- 470,482 ----
        b+= sizeof(double);
        break;
      case HA_KEYTYPE_NUM:				/* Numeric key */
+     {
+       int swap_flag=keyseg->base.flag & HA_REVERSE_SORT;
        if (keyseg->base.flag & HA_SPACE_PACK)
        {
  	int alength,blength;
  
! 	if (swap_flag)
  	  swap(uchar*,a,b);
  	alength= *a++; blength= *b++;
  	if ((flag=(int) (keyseg->base.length-key_length)) < 0)
***************
*** 487,492 ****
--- 489,499 ----
  	  else
  	    return -1;
  	}
+ 	if (*a == '-' && *b == '-')
+ 	{
+ 	  swap_flag=1;
+ 	  swap(uchar*,a,b);
+ 	}
  	end=a+alength;
  	while (a < end)
  	  if (*a++ !=  *b++)
***************
*** 504,510 ****
        }
        else
        {
! 	if (keyseg->base.flag & HA_REVERSE_SORT)
  	{
  	  end=b+(int) (end-a);
  	  swap(uchar*,a,b);
--- 511,520 ----
        }
        else
        {
! 	for ( ; a < end && *a == ' ' && *b == ' ' ; a++, b++) ;
! 	if (*a == '-' && *b == '-')
! 	  swap_flag=1;
! 	if (swap_flag)
  	{
  	  end=b+(int) (end-a);
  	  swap(uchar*,a,b);
***************
*** 523,531 ****
  	      return -1;
  	  }
        }
!       if (keyseg->base.flag & HA_REVERSE_SORT)
  	swap(uchar*,a,b);
        break;
  #ifdef HAVE_LONG_LONG
      case HA_KEYTYPE_LONGLONG:
      {
--- 533,542 ----
  	      return -1;
  	  }
        }
!       if (swap_flag)
  	swap(uchar*,a,b);
        break;
+     }
  #ifdef HAVE_LONG_LONG
      case HA_KEYTYPE_LONGLONG:
      {


Regards,
Monty
Thread
Bug in min() functionFrank Oellien22 Nov
  • Bug in min() functionMichael Widenius23 Nov
  • Re: Bug in min() functionFrank Oellien23 Nov
    • Re: Bug in min() functionMichael Widenius24 Nov
    • Re: Bug in min() functionMichael Widenius24 Nov