Commit d1c5ca31 authored by unknown's avatar unknown
Browse files

Merge bk-internal:/home/bk/mysql-4.0/

into serg.mylan:/usr/home/serg/Abk/mysql-4.0

parents 03a20c23 432a0f36
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -114,6 +114,9 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
create table t1 (c20 char);
insert into t1 (c20) values (5000.0);
drop table t1;
create table t1 (f float(54));
Incorrect column specifier for column 'f'
drop table if exists t1;
+7 −0
Original line number Diff line number Diff line
@@ -54,6 +54,13 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;

#
# float in a char(1) field
#
create table t1 (c20 char);
insert into t1 (c20) values (5000.0);
drop table t1;

# Errors

--error 1063
+4 −2
Original line number Diff line number Diff line
@@ -3733,15 +3733,17 @@ static void store_double_in_string_field(Field_str *field, uint32 field_length,
    use_scientific_notation= (field->ceiling < nr);
  }
  length= (uint)sprintf(buff, "%-.*g",
                        use_scientific_notation ? max(0,field_length-5) : field_length,
                        use_scientific_notation ? max(0,(int)field_length-5) : field_length,
                        nr);
  /*
    +1 below is because "precision" in %g above means the
    max. number of significant digits, not the output width.
    Thus the width can be larger than number of significant digits by 1
    (for decimal point)
    the test for field_length < 5 is for extreme cases,
    like inserting 500.0 in char(1)
  */
  DBUG_ASSERT(length <= field_length+1);
  DBUG_ASSERT(field_length < 5 || length <= field_length+1);
  field->store(buff, min(length, field_length));
}