Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2133 06/06/08 13:06:10 msvensson@neptunus.(none) +6 -0
Merge neptunus.(none):/home/msvensson/mysql/bug7498/my41-bug7498
into neptunus.(none):/home/msvensson/mysql/bug7498/my50-bug7498
sql/item_func.cc
1.285 06/06/08 13:06:06 msvensson@neptunus.(none) +0 -0
Merge from 4.1
sql/item.cc
1.219 06/06/08 13:06:05 msvensson@neptunus.(none) +0 -3
Merge from 4.1
mysql-test/t/user_var.test
1.34 06/06/08 13:06:05 msvensson@neptunus.(none) +0 -0
Manual merge
mysql-test/r/user_var.result
1.39 06/06/08 13:06:05 msvensson@neptunus.(none) +0 -0
Manual merge
sql/sql_class.h
1.289 06/06/08 13:04:18 msvensson@neptunus.(none) +0 -0
Auto merged
sql/item_subselect.cc
1.124 06/06/08 13:04:18 msvensson@neptunus.(none) +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: msvensson
# Host: neptunus.(none)
# Root: /home/msvensson/mysql/bug7498/my50-bug7498/RESYNC
--- 1.284/sql/item_func.cc 2006-05-09 10:44:13 +02:00
+++ 1.285/sql/item_func.cc 2006-06-08 13:06:06 +02:00
@@ -3408,6 +3408,7 @@
entry->length=0;
entry->update_query_id=0;
entry->collation.set(NULL, DERIVATION_IMPLICIT);
+ entry->unsigned_flag= 0;
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -3549,6 +3550,7 @@
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
entry->collation.set(cs, dv);
+ entry->unsigned_flag= unsigned_flag;
}
entry->type=type;
return 0;
@@ -3648,7 +3650,10 @@
str->set(*(double*) value, decimals, &my_charset_bin);
break;
case INT_RESULT:
- str->set(*(longlong*) value, &my_charset_bin);
+ if (!unsigned_flag)
+ str->set(*(longlong*) value, &my_charset_bin);
+ else
+ str->set(*(ulonglong*) value, &my_charset_bin);
break;
case DECIMAL_RESULT:
my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
@@ -3719,6 +3724,8 @@
case INT_RESULT:
{
save_result.vint= args[0]->val_int();
+ unsigned_flag= args[0]->unsigned_flag;
+
break;
}
case STRING_RESULT:
--- 1.288/sql/sql_class.h 2006-04-13 09:25:52 +02:00
+++ 1.289/sql/sql_class.h 2006-06-08 13:04:18 +02:00
@@ -1954,6 +1954,7 @@
ulong length;
query_id_t update_query_id, used_query_id;
Item_result type;
+ bool unsigned_flag;
double val_real(my_bool *null_value);
longlong val_int(my_bool *null_value);
--- 1.123/sql/item_subselect.cc 2006-04-28 12:06:51 +02:00
+++ 1.124/sql/item_subselect.cc 2006-06-08 13:04:18 +02:00
@@ -462,8 +462,10 @@
DBUG_ASSERT(fixed == 1);
if (!exec() && !value->null_value)
{
+ longlong nr= value->val_int();
null_value= 0;
- return value->val_int();
+ unsigned_flag= value->unsigned_flag;
+ return nr;
}
else
{
--- 1.38/mysql-test/r/user_var.result 2006-04-27 02:09:37 +02:00
+++ 1.39/mysql-test/r/user_var.result 2006-06-08 13:06:05 +02:00
@@ -193,6 +193,42 @@
set session @honk=99;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@honk=99' at line 1
set one_shot @honk=99;
+set @a=18446744071710965857;
+select @a;
+@a
+18446744071710965857
+CREATE TABLE `bigfailure` (
+`afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+afield
+18446744071710965857
+select * from (SELECT afield FROM bigfailure) as b;
+afield
+18446744071710965857
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965857;
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965856+1;
+afield
+18446744071710965857
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+@a
+18446744071710965857
+drop table bigfailure;
ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
select @@local.max_allowed_packet;
@@local.max_allowed_packet
--- 1.33/mysql-test/t/user_var.test 2006-04-27 02:09:37 +02:00
+++ 1.34/mysql-test/t/user_var.test 2006-06-08 13:06:05 +02:00
@@ -144,6 +144,37 @@
--replace_column 1 #
select @@global.version;
+#
+# Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
+#
+
+# First part, set user var to large number and select it
+set @a=18446744071710965857;
+select @a;
+
+# Second part, set user var from large number in table
+# then select it
+CREATE TABLE `bigfailure` (
+ `afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+select * from (SELECT afield FROM bigfailure) as b;
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+select * from bigfailure where afield = 18446744071710965857;
+# This is fixed in 5.0, to be uncommented there
+#select * from bigfailure where afield = '18446744071710965857';
+select * from bigfailure where afield = 18446744071710965856+1;
+
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+
+drop table bigfailure;
+
# End of 4.1 tests
#
| Thread |
|---|
| • bk commit into 5.0 tree (msvensson:1.2133) | msvensson | 8 Jun |