Bug #63721 | A problem about varchar type | ||
---|---|---|---|
Submitted: | 12 Dec 2011 8:43 | Modified: | 13 Dec 2011 8:22 |
Reporter: | 心意 舒 | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.5.15-log | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | varchar |
[12 Dec 2011 8:43]
心意 舒
[12 Dec 2011 9:08]
Peter Laursen
Immediately after the INSERT try execute "SHOW WARNINGS;". You will see a warning that data were truncated. If you don't want this behavior set a 'strict' sql_mode for the connection (like "SET SQL_MODE = 'strict_all_tables';") or start the server in strict mode. Then you will get a plain error and nothing will be inserted. This is expected behavior with MySQL. Peter (not a MySQL person)
[12 Dec 2011 9:26]
Valeriy Kravchuk
Please, send the output of: select @@sql_mode; Read the manual, http://dev.mysql.com/doc/refman/5.1/en/char.html: "If strict SQL mode is not enabled and you assign a value to a CHAR or VARCHAR column that exceeds the column's maximum length, the value is truncated to fit and a warning is generated." I think it explains the result you get.
[13 Dec 2011 8:01]
心意 舒
Thank you for your help! It's my fault! I have resolved!
[13 Dec 2011 8:07]
心意 舒
This is not a bug! Thank you for your answers!