On Wed, Oct 7, 2009 at 11:21 AM, Philip Hallstrom <[email protected]> wrote:
> So where the
> issues of inserting data that is too long and having it be silently
> truncated -- yes, I'm ignoring the warnings MySQL provides. It should
> raise an error...
It does raise an error if you're knowledgeable enough to know about
the various strict modes you can set:
mysql> create table test4 (name char(3));
Query OK, 0 rows affected (0.03 sec)
mysql> insert into test4 values ('four');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> SELECT * FROM test4;
+------+
| name |
+------+
| fou |
+------+
1 row in set (0.00 sec)
mysql> SET SQL_MODE = 'STRICT_ALL_TABLES';
Query OK, 0 rows affected (0.00 sec)
mysql> insert into test4 values ('four');
ERROR 1406 (22001): Data too long for column 'name' at row 1
> I notice that as of 5.0.51a-24 it still turns invalid dates into
> 0000-00-00 (with the warning, but no error).
Similarly there is NO_ZERO_DATE strict mode for use with dates.
--
Greg Donald
http://destiney.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---