Hi! >>>>> "root" == root <[EMAIL PROTECTED]> writes: >> Description: root> In certain cases the select fails (ie (a) does not return required rows, or (b) returns non-wanted rows (cannot repeat (b))) root> The problem seems to be related to negative values in decimal type fields and in query against those fields. root> the problem is applicable to several 3.22.* versions on different machines, have no possibility to check with 3.23.*. >> How-To-Repeat: <cut> mysql> select * from dataformats where minvalue(=-1 and maxvalue)=-1 and datatype_id=16; root> Empty set (0.00 sec) Fix: ===== sql/field.cc 1.28 vs edited ===== *** sql/field.cc-1.28 Mon Jan 15 22:57:08 2001 --- edited/sql/field.cc Tue Jan 16 02:07:57 2001 *************** *** 597,620 **** int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) { const char *end; /* First remove prefixes '0', ' ', and '-' */ for (end=a_ptr+field_length; a_ptr != end && (*a_ptr == *b_ptr || ((isspace(*a_ptr) || *a_ptr == '+' || *a_ptr == '0') && (isspace(*b_ptr) || *b_ptr == '+' || *b_ptr == '0'))); ! a_ptr++,b_ptr++) ; ! if (a_ptr == end) return 0; - int swap=0; if (*a_ptr == '-') ! { ! if (*b_ptr != '-') ! return -1; ! swap= -1 ^ 1; // Swap result ! a_ptr++, b_ptr++; ! } else if (*b_ptr == '-') return 1; while (a_ptr != end) --- 597,619 ---- int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) { const char *end; + int swap=0; /* First remove prefixes '0', ' ', and '-' */ for (end=a_ptr+field_length; a_ptr != end && (*a_ptr == *b_ptr || ((isspace(*a_ptr) || *a_ptr == '+' || *a_ptr == '0') && (isspace(*b_ptr) || *b_ptr == '+' || *b_ptr == '0'))); ! a_ptr++,b_ptr++) ! { ! if (*a_ptr == '-') // If both numbers are negative ! swap= -1 ^ 1; // Swap result ! } if (a_ptr == end) return 0; if (*a_ptr == '-') ! return -1; ! else if (*b_ptr == '-') return 1; while (a_ptr != end) Regards, Monty --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php