In article <[EMAIL PROTECTED]>,
"Martijn Tonies" <[EMAIL PROTECTED]> writes:

mysql> insert into dt set a=999.1;
>> Query OK, 1 row affected (0.00 sec)
>> 
mysql> alter table dt change a a decimal(2,1);
>> Query OK, 1 row affected, 1 warning (0.02 sec)
>> Records: 1  Duplicates: 0  Warnings: 1
>> 
mysql> show warnings;
>> +---------+------+-----------------------------------------------------+
>> | Level   | Code | Message                                             |
>> +---------+------+-----------------------------------------------------+
>> | Warning | 1264 | Out of range value adjusted for column 'a' at row 1 |
>> +---------+------+-----------------------------------------------------+

> Could be me ... but isn't this a little too late?

> eg: AFTER you have lost your data?

> IMO, it should raise an error UNLESS you force it to truncate the data.

This would contradict the "MySQL design philosophy" (others call it
simply "gotcha") that the user should know what he's doing and the
DBMS tries its best to obey.  Consider this (version 4.1.14):

  CREATE TEMPORARY TABLE t1 (
    i TINYINT
  );

  INSERT INTO  t1 VALUES (42);

  SELECT * FROM t1;
  -- Ok, shows 42

  UPDATE t1 SET i = 4242;
  -- SHOW WARNINGS;

  SELECT * FROM t1;
  -- Oops, shows 127


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to