Thanks; you're absolutely right - doh! It's just amazing that this ever
worked in MySQL 4.0 and below...
Andrew
-----Original Message-----
From: Roger Baklund [mailto:roger@stripped]
Sent: Mon, 19 Sep 2005 12:27
To: mysql@stripped
Cc: Andrew Braithwaite
Subject: Re: possible MySQL bug - insert into 'double' column problem
with mysql 4.1
Andrew Braithwaite wrote:
> Hi All,
>
> I have a strange error when trying to insert into a table with 2
> 'double' fields. It inserts into the 1st field OK but fills the 2nd
one
> with nines. See below for a complete recreate.
[...]
> | lon | double(7,6) | YES | MUL | NULL |
|
> | lat | double(7,6) | YES | | NULL |
|
From the manual:
DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]
M is the total number of decimal digits and D is the number of digits
following the decimal point.
<URL: http://dev.mysql.com/doc/mysql/en/numeric-type-overview.html >
> mysql> INSERT INTO table1VALUES
> (8002,'2a',-0.361080,39.468270,'2005-08-31','ES052',NULL,NULL);
> Query OK, 1 row affected, 1 warning (0.01 sec)
>
> mysql> select * from table1 where id=8002\G
> *************************** 1. row ***************************
> id: 8002
> GeoQuality: 2a
> lon: -0.361080
> lat: 9.999999
You have created your columns with a max width of 7, out of which 6 are
decimals, but you are trying to insert a number with 8 digits.
--
Roger