Bug #26359 | Strings becoming truncated and converted to numbers under STRICT mode | ||
---|---|---|---|
Submitted: | 14 Feb 2007 8:55 | Modified: | 10 Apr 2007 18:15 |
Reporter: | Tobias Asplund | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S2 (Serious) |
Version: | 5.0.36-BK, 5.0.33 | OS: | Linux (Linux, Mac OS X) |
Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
Tags: | 5.0.18, regression |
[14 Feb 2007 8:55]
Tobias Asplund
[14 Feb 2007 9:30]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described with latest 5.0.36-BK on Linux: openxs@suse:~/dbs/5.0> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.36 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE TABLE bugtest ( a INT ); SEQuery OK, 0 rows affected (0.01 sec) mysql> SET sql_mode = 'STRICT_ALL_TABLES'; Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO bugtest VALUES ('-'); DQuery OK, 1 row affected (0.00 sec)
[27 Feb 2007 21:31]
Konstantin Osipov
Assigning to maintenance for investigation. Please assign back to runtime if find complex.
[16 Mar 2007 8:18]
Ramil Kalimullin
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/22095
[26 Mar 2007 6:22]
Alexander Barkov
The patch http://lists.mysql.com/commits/22095 is ok to push. I only found a very small thing, which is not harmful GCC, but other compilers will likely generate warnings. In this piece of code: +bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len, + longlong *rnd, ulonglong unsigned_max, + longlong signed_min, longlong signed_max) +{ + char *end; + int error; + + *rnd= cs->cset->strntoull10rnd(cs, from, len, unsigned_flag, &end, The "rnd" variable is a pointer to "longlong" type, while strntoull10rnd() return type is "ulonglong". Adding an implicit cast should make the code safe against warnings: *rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len, unsigned_flag, &end,
[10 Apr 2007 16:06]
Timothy Smith
Pushed, for 5.0.40 and 5.1.18-beta
[10 Apr 2007 18:15]
Paul DuBois
Noted in 5.0.40, 5.1.18 changelogs. String truncation upon insertion into a integer column did not generate a warning (or an error in strict mode).