Commit 8d1ab8b4 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.0-maint

into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint

parents d8dd784f ff07adae
...@@ -1423,3 +1423,11 @@ cast(19999999999999999999 as unsigned) ...@@ -1423,3 +1423,11 @@ cast(19999999999999999999 as unsigned)
18446744073709551615 18446744073709551615
Warnings: Warnings:
Error 1292 Truncated incorrect DECIMAL value: '' Error 1292 Truncated incorrect DECIMAL value: ''
create table t1(a decimal(18));
insert into t1 values(123456789012345678);
alter table t1 modify column a decimal(19);
select * from t1;
a
123456789012345678
drop table t1;
End of 5.0 tests
...@@ -1120,3 +1120,14 @@ drop table t1; ...@@ -1120,3 +1120,14 @@ drop table t1;
# #
select cast(19999999999999999999 as unsigned); select cast(19999999999999999999 as unsigned);
#
# Bug #24558: Increasing decimal column length causes data loss
#
create table t1(a decimal(18));
insert into t1 values(123456789012345678);
alter table t1 modify column a decimal(19);
select * from t1;
drop table t1;
--echo End of 5.0 tests
...@@ -337,6 +337,13 @@ static void do_field_real(Copy_field *copy) ...@@ -337,6 +337,13 @@ static void do_field_real(Copy_field *copy)
} }
static void do_field_decimal(Copy_field *copy)
{
my_decimal value;
copy->to_field->store_decimal(copy->from_field->val_decimal(&value));
}
/* /*
string copy for single byte characters set when to string is shorter than string copy for single byte characters set when to string is shorter than
from string from string
...@@ -581,6 +588,8 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*) ...@@ -581,6 +588,8 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
if (to->real_type() == FIELD_TYPE_BIT || if (to->real_type() == FIELD_TYPE_BIT ||
from->real_type() == FIELD_TYPE_BIT) from->real_type() == FIELD_TYPE_BIT)
return do_field_int; return do_field_int;
if (to->result_type() == DECIMAL_RESULT)
return do_field_decimal;
// Check if identical fields // Check if identical fields
if (from->result_type() == STRING_RESULT) if (from->result_type() == STRING_RESULT)
{ {
......
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