Commit 7c6ed734 authored by unknown's avatar unknown

Revert patch for bigint handling in double context as it broke normal bigint handling

The right way to fix this is to change the Field::store(longlong) method to be
Field::store(longlong, bool unsigned_flag), but this is better to do in 4.1 than in 4.0


mysql-test/r/bigint.result:
  New tests to show how the last bigint patch broke MySQL
mysql-test/t/bigint.test:
  New tests to show how the last bigint patch broke MySQL
sql/item.cc:
  Revert patch for bigint handling in double context as it broke normal bigint handling
sql/item.h:
  Revert patch for bigint handling in double context as it broke normal bigint handling
parent cd878c2c
......@@ -15,9 +15,11 @@ select 9223372036854775808+1;
9223372036854775809
drop table if exists t1;
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t1 where a=18446744073709551615;
......@@ -26,6 +28,8 @@ a
delete from t1 where a=18446744073709551615;
select * from t1;
a
18446744073709551612
18446744073709551613
18446744073709551614
drop table t1;
create table t1 ( a int not null default 1, big bigint );
......@@ -69,9 +73,11 @@ id a
drop table t1;
CREATE TABLE t1 ( quantity decimal(60,0));
insert into t1 values (10000000000000000000);
insert into t1 values (10000000000000000000.0);
insert into t1 values ('10000000000000000000');
select * from t1;
quantity
-8446744073709551616
10000000000000000000
10000000000000000000
drop table t1;
......@@ -14,7 +14,7 @@ select 9223372036854775808+1;
drop table if exists t1;
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;
select * from t1 where a=18446744073709551615;
# select * from t1 where a='18446744073709551615';
......@@ -50,10 +50,12 @@ drop table t1;
#
# Item_uint::save_to_field()
# BUG#1845
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
#
CREATE TABLE t1 ( quantity decimal(60,0));
insert into t1 values (10000000000000000000);
insert into t1 values (10000000000000000000.0);
insert into t1 values ('10000000000000000000');
select * from t1;
drop table t1;
......
......@@ -548,18 +548,6 @@ bool Item_string::save_in_field(Field *field, bool no_conversions)
return 0;
}
bool Item_uint::save_in_field(Field *field, bool no_conversions)
{
longlong nr=val_int();
if (null_value)
return set_field_to_null(field);
field->set_notnull();
if (nr < 0)
field->store(ulonglong2double(nr));
else
field->store(nr);
return 0;
}
bool Item_int::save_in_field(Field *field, bool no_conversions)
{
......
......@@ -232,7 +232,6 @@ class Item_uint :public Item_int
String *val_str(String*);
void make_field(Send_field *field);
Item *new_item() { return new Item_uint(name,max_length); }
bool save_in_field(Field *field, bool no_conversions);
bool fix_fields(THD *thd,struct st_table_list *table_list)
{
unsigned_flag= 1;
......
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