At 10:12 PM 12/20/2002 -0600, Paul DuBois wrote:
>>> For a 10,2 decimal column, should this be a valid number: 1234567890.12?
 It's easy to test:

 mysql> CREATE TABLE t (d DECIMAL(10,2));
 Query OK, 0 rows affected (0.01 sec)

 mysql> INSERT INTO t SET d = 1234567890.12;
 Query OK, 1 row affected (0.01 sec)

 mysql> SELECT * FROM t;
 +--------------+
 | d            |
 +--------------+
 | 999999999.99 |
 +--------------+
 1 row in set (0.00 sec)

 The value's been clipped to the upper end of the range.

 Your next question should be why that value has 9 digits to the left
 of the decimal point. :-)

How did you guess! This behaviour is why I asked the question in the first
place. Why does it get clipped for a 10 digit number. Without the decimal
value I believe it inserts correctly, but with the 2 decimal places it get
clipped...
--
Michael She : [EMAIL PROTECTED]
Mobile : (519) 589-7309
WWW Homepage : http://www.binaryio.com/


 mysql> INSERT INTO t SET d = 1234567890.12;
 Query OK, 1 row affected (0.01 sec)
A different question would be why does MySQL not generate an error or
warning on the insert when it mangled the value?
The philosophy is that it's the clients responsibility not to insert
bad data.

I think more error checking should still be done.

Often times the client doesn't know the datatype of the columns, hence it is very hard for the client to do error checking.


--
Michael She : [EMAIL PROTECTED]
Mobile : (519) 589-7309
WWW Homepage : http://www.binaryio.com/


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to