Commit 0b6a7865 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Don't change FLOAT(X+1,X) to FLOAT(X+2,X)

parent 64234373
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -46857,7 +46857,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code.
@menu
* News-3.23.51::                
* News-3.23.51::                Changes in release 3.23.51
* News-3.23.50::                Changes in release 3.23.50
* News-3.23.49::                Changes in release 3.23.49
* News-3.23.48::                Changes in release 3.23.48
@@ -46915,6 +46915,10 @@ not yet 100% confident in this code.
@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
Fixed the @code{FLOAT(X+1,X)} is not converted to @code{FLOAT(X+2,X)}.
(This also affected @code{DECIMAL}, @code{DOUBLE} and @code{REAL} types)
@item
Fixed the result from @code{IF()} is case in-sensitive if the 2 and
third arguments are case sensitive.
@end itemize
+16 −0
Original line number Diff line number Diff line
@@ -92,3 +92,19 @@ t1 CREATE TABLE `t1` (
  `a` int(11) NOT NULL default '0',
  PRIMARY KEY  (`a`)
) TYPE=MyISAM
Field	Type	Null	Key	Default	Extra
a	decimal(9,2)	YES		NULL	
b	decimal(9,0)	YES		NULL	
e	double(9,2)	YES		NULL	
f	double(5,0)	YES		NULL	
h	float(3,2)	YES		NULL	
i	float(3,0)	YES		NULL	
Field	Type	Null	Key	Default	Extra
c	decimal(10,0)	YES		NULL	
d	double	YES		NULL	
f	float	YES		NULL	
r	double	YES		NULL	
Field	Type	Null	Key	Default	Extra
c	decimal(4,3)	YES		NULL	
d	double(4,3)	YES		NULL	
f	float(4,3)	YES		NULL	
+14 −0
Original line number Diff line number Diff line
@@ -73,3 +73,17 @@ drop table t1;
create table t1 (a int not null, primary key (a));
show create table t1;
drop table t1;

create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
show columns from t1;
drop table t1;

# Check auto conversions of types

create table t1 (c decimal, d double, f float, r real);
show columns from t1;
drop table t1;

create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1;
drop table t1;
+2 −2
Original line number Diff line number Diff line
@@ -2432,9 +2432,9 @@ bool add_field_to_list(char *field_name, enum_field_types type,
  uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1;

  if (new_field->length && new_field->decimals &&
      new_field->length < new_field->decimals+2 &&
      new_field->length < new_field->decimals+1 &&
      new_field->decimals != NOT_FIXED_DEC)
    new_field->length=new_field->decimals+2; /* purecov: inspected */
    new_field->length=new_field->decimals+1; /* purecov: inspected */

  switch (type) {
  case FIELD_TYPE_TINY: