shantanu oak <shantanu.oak@stripped> wrote on 07/18/2005 01:17:57 PM:
> I am getting two different results for the same set of commands on two
> different versions of MySQL.
> Can anyone explain what the issue is?
> CREATE TABLE `testdecimal` (
> `rate` decimal(7,4) NOT NULL default '0.0000'
> ) ENGINE=MyISAM;
> INSERT INTO testdecimal SET rate=1468;
> select * from testdecimal;
> version 4.1.12
> version 5.0
> Shantanu Oak
They fixed a bug. Count how many digits are in this number from your
8 is more than 7. That violates your definition of (7,4). What you want is
to declare (8.4) to be able to store numbers that large. The reason you
get 999.9999 with 5.0 is because that is the number closest to your target
value available for the field definition you declared.
The "old" behavior allowed an extra digit to possibly take the place of
the "sign" marker (positive or negative) and since your number was not
negative, your sign marker was "blank" which allowed your number to
overflow its definition. That is the bug they fixed.
Unimin Corporation - Spruce Pine