Commit 87f7d168 authored by unknown's avatar unknown

merging fixes


mysql-test/r/type_datetime.result:
  result fixed
mysql-test/t/type_datetime.test:
  testcase fixed
sql/item_func.cc:
  my_decimal_length_to_precision used
sql/my_decimal.h:
  merging fix
parent 3838978e
...@@ -328,8 +328,8 @@ least(cast('01-01-01' as datetime), '01-01-02') + 0 ...@@ -328,8 +328,8 @@ least(cast('01-01-01' as datetime), '01-01-02') + 0
select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
cast(least(cast('01-01-01' as datetime), '01-01-02') as signed) cast(least(cast('01-01-01' as datetime), '01-01-02') as signed)
20010101000000 20010101000000
select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal); select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2));
cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal) cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2))
20010101000000.00 20010101000000.00
DROP PROCEDURE IF EXISTS test27759 ; DROP PROCEDURE IF EXISTS test27759 ;
CREATE PROCEDURE test27759() CREATE PROCEDURE test27759()
......
...@@ -207,7 +207,7 @@ select least(cast('01-01-01' as date), '01-01-02') + 0; ...@@ -207,7 +207,7 @@ select least(cast('01-01-01' as date), '01-01-02') + 0;
select greatest(cast('01-01-01' as date), '01-01-02') + 0; select greatest(cast('01-01-01' as date), '01-01-02') + 0;
select least(cast('01-01-01' as datetime), '01-01-02') + 0; select least(cast('01-01-01' as datetime), '01-01-02') + 0;
select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal); select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2));
--disable_warnings --disable_warnings
DROP PROCEDURE IF EXISTS test27759 ; DROP PROCEDURE IF EXISTS test27759 ;
--enable_warnings --enable_warnings
......
...@@ -1051,6 +1051,8 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec) ...@@ -1051,6 +1051,8 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
{ {
my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf); my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf);
bool sign; bool sign;
uint precision;
if ((null_value= args[0]->null_value)) if ((null_value= args[0]->null_value))
return NULL; return NULL;
my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec); my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec);
...@@ -1063,9 +1065,11 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec) ...@@ -1063,9 +1065,11 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
goto err; goto err;
} }
} }
if (max_length - 2 - decimals < (uint) my_decimal_intg(dec)) precision= my_decimal_length_to_precision(max_length,
decimals, unsigned_flag);
if (precision - decimals < (uint) my_decimal_intg(dec))
{ {
max_my_decimal(dec, max_length - 2, decimals); max_my_decimal(dec, precision, decimals);
dec->sign(sign); dec->sign(sign);
goto err; goto err;
} }
...@@ -1084,7 +1088,6 @@ void Item_decimal_typecast::print(String *str) ...@@ -1084,7 +1088,6 @@ void Item_decimal_typecast::print(String *str)
{ {
char len_buf[20*3 + 1]; char len_buf[20*3 + 1];
char *end; char *end;
CHARSET_INFO *cs= str->charset();
uint precision= my_decimal_length_to_precision(max_length, decimals, uint precision= my_decimal_length_to_precision(max_length, decimals,
unsigned_flag); unsigned_flag);
......
...@@ -395,6 +395,7 @@ int my_decimal_intg(const my_decimal *a) ...@@ -395,6 +395,7 @@ int my_decimal_intg(const my_decimal *a)
} }
inline
void my_decimal_trim(ulong *precision, uint *scale) void my_decimal_trim(ulong *precision, uint *scale)
{ {
if (!(*precision) && !(*scale)) if (!(*precision) && !(*scale))
......
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