Commit 1b3ffb1b authored by unknown's avatar unknown

Fix for BUG#8562: In Item_int_with_ref::new_item() create Item_int or Item_uint

depending on ref->unsigned_flag. Item_int_with_ref can refer to both signed and 
unsigned integers.


mysql-test/r/bigint.result:
  Test case for BUG#8562
mysql-test/t/bigint.test:
  Test case for BUG#8562
parent 79cdcc7b
...@@ -87,3 +87,42 @@ drop table t1; ...@@ -87,3 +87,42 @@ drop table t1;
SELECT '0x8000000000000001'+0; SELECT '0x8000000000000001'+0;
'0x8000000000000001'+0 '0x8000000000000001'+0
0 0
create table t1 (
value64 bigint unsigned not null,
value32 integer not null,
primary key(value64, value32)
);
create table t2 (
value64 bigint unsigned not null,
value32 integer not null,
primary key(value64, value32)
);
insert into t1 values(17156792991891826145, 1);
insert into t1 values( 9223372036854775807, 2);
insert into t2 values(17156792991891826145, 3);
insert into t2 values( 9223372036854775807, 4);
select * from t1;
value64 value32
9223372036854775807 2
17156792991891826145 1
select * from t2;
value64 value32
9223372036854775807 4
17156792991891826145 3
select * from t1, t2 where t1.value64=17156792991891826145 and
t2.value64=17156792991891826145;
value64 value32 value64 value32
17156792991891826145 1 17156792991891826145 3
select * from t1, t2 where t1.value64=17156792991891826145 and
t2.value64=t1.value64;
value64 value32 value64 value32
17156792991891826145 1 17156792991891826145 3
select * from t1, t2 where t1.value64= 9223372036854775807 and
t2.value64=9223372036854775807;
value64 value32 value64 value32
9223372036854775807 2 9223372036854775807 4
select * from t1, t2 where t1.value64= 9223372036854775807 and
t2.value64=t1.value64;
value64 value32 value64 value32
9223372036854775807 2 9223372036854775807 4
drop table t1, t2;
...@@ -71,3 +71,36 @@ drop table t1; ...@@ -71,3 +71,36 @@ drop table t1;
# atof() behaviour is different of different systems. to be fixed in 4.1 # atof() behaviour is different of different systems. to be fixed in 4.1
SELECT '0x8000000000000001'+0; SELECT '0x8000000000000001'+0;
# Test for BUG#8562: joins over BIGINT UNSIGNED value + constant propagation
create table t1 (
value64 bigint unsigned not null,
value32 integer not null,
primary key(value64, value32)
);
create table t2 (
value64 bigint unsigned not null,
value32 integer not null,
primary key(value64, value32)
);
insert into t1 values(17156792991891826145, 1);
insert into t1 values( 9223372036854775807, 2);
insert into t2 values(17156792991891826145, 3);
insert into t2 values( 9223372036854775807, 4);
select * from t1;
select * from t2;
select * from t1, t2 where t1.value64=17156792991891826145 and
t2.value64=17156792991891826145;
select * from t1, t2 where t1.value64=17156792991891826145 and
t2.value64=t1.value64;
select * from t1, t2 where t1.value64= 9223372036854775807 and
t2.value64=9223372036854775807;
select * from t1, t2 where t1.value64= 9223372036854775807 and
t2.value64=t1.value64;
drop table t1, t2;
...@@ -1011,6 +1011,11 @@ public: ...@@ -1011,6 +1011,11 @@ public:
{ {
return ref->save_in_field(field, no_conversions); return ref->save_in_field(field, no_conversions);
} }
Item *new_item()
{
return (ref->unsigned_flag)? new Item_uint(ref->name, ref->max_length) :
new Item_int(ref->name, ref->max_length);
}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment