Fix for BUG#7425.

The reported problems were due to two completely unrelated omissions.
1) The file sort procedure didn't correctly create the sort key in
   make_sortkey when the sortkey was an unsigned integer.
2) The name resolution procedure for column references inside a HAVING
   clause did not propagate the unsigned_flag of the resolved references.
This patch corrects both problems.


mysql-test/r/select.result:
  Added test result for BUG#7425.
mysql-test/t/select.test:
  Added test for BUG#7425.
sql/filesort.cc:
  Take into account whether 'item' represents a signed or an unsigned integer.
sql/item.cc:
  Once an Item_ref is resolved, propagate the unsigned_flag to the resolved item.
This commit is contained in:
unknown 2005-03-09 16:51:03 +02:00
commit 146df30f79
4 changed files with 43 additions and 2 deletions

View file

@ -656,12 +656,18 @@ static void make_sortkey(register SORTPARAM *param,
to[3]= (uchar) (value >> 32);
to[2]= (uchar) (value >> 40);
to[1]= (uchar) (value >> 48);
to[0]= (uchar) (value >> 56) ^ 128; // Fix sign
if (item->unsigned_flag) /* Fix sign */
to[0]= (uchar) (value >> 56);
else
to[0]= (uchar) (value >> 56) ^ 128; /* Reverse signbit */
#else
to[3]= (uchar) value;
to[2]= (uchar) (value >> 8);
to[1]= (uchar) (value >> 16);
to[0]= (uchar) (value >> 24) ^ 128; // Fix sign
if (item->unsigned_flag) /* Fix sign */
to[0]= (uchar) (value >> 24);
else
to[0]= (uchar) (value >> 24) ^ 128; /* Reverse signbit */
#endif
break;
}