summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2005-03-09 16:51:03 +0200
committerunknown <timour@mysql.com>2005-03-09 16:51:03 +0200
commit146df30f791246b93225b68ffaf6e93af4148f39 (patch)
treee53786b9ea2236b829616babd07965d5e50f3e6e /sql
parentae81d53048643da4b110c936eaec0a895af06219 (diff)
downloadmariadb-git-146df30f791246b93225b68ffaf6e93af4148f39.tar.gz
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.
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc10
-rw-r--r--sql/item.cc1
2 files changed, 9 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 76ce9ac4ce2..c6af8cfc1b7 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -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;
}
diff --git a/sql/item.cc b/sql/item.cc
index 1293d2c94fe..690ada2d660 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2281,6 +2281,7 @@ void Item_ref::set_properties()
decimals= (*ref)->decimals;
collation.set((*ref)->collation);
with_sum_func= (*ref)->with_sum_func;
+ unsigned_flag= (*ref)->unsigned_flag;
fixed= 1;
}