On 12/13/12 3:03 PM, Stephen Russell wrote:
> On Thu, Dec 13, 2012 at 4:53 PM, Paul McNett <[email protected]> wrote:
> 
>> On 12/13/12 9:58 AM, Stephen Russell wrote:
>>> Change a data column on a a production system.  Numeric width and make is
>>> smaller.  MySQL will not warn you that your existing data may be
>> incorrect.
>>>  It will just do it.  #FAIL   So 100 units will now = 99 units.  Wow that
>>> is so wrong.
>>
>> The assumption is that the DBA knows what he or she is doing. Duh,
>> changing the
>> precision of a column could affect the data.
>> -----------------
> 
> 
> My point was that the engine didn't warn you about truncating data.  It
> just did it.  VFP even tells you beforehand.

Hm.

mysql> create table test (test decimal (8,3));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into test (test) values (8.03);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+-------+
| test  |
+-------+
| 8.030 |
+-------+
1 row in set (0.00 sec)

mysql> alter table test modify column test decimal(8,2);
Query OK, 1 row affected (0.06 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> select * from test;
+------+
| test |
+------+
| 8.03 |
+------+
1 row in set (0.01 sec)

mysql> alter table test modify column test decimal(8,1);
Query OK, 1 row affected, 1 warning (0.04 sec)
Records: 1  Duplicates: 0  Warnings: 1

mysql> show warnings;
+-------+------+-------------------------------------------+
| Level | Code | Message                                   |
+-------+------+-------------------------------------------+
| Note  | 1265 | Data truncated for column 'test' at row 1 |
+-------+------+-------------------------------------------+
1 row in set (0.00 sec)

Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to