Bug #85634 | C API prepared statement update/insert MYSQL_TYPE_TINY fails with 8th bit | ||
---|---|---|---|
Submitted: | 27 Mar 2017 2:08 | Modified: | 28 Mar 2017 10:53 |
Reporter: | Michael Buchberger | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S1 (Critical) |
Version: | 5.7.7 | OS: | SUSE |
Assigned to: | CPU Architecture: | Any | |
Tags: | 8bit, C API, MYSQL_TYPE_TINY |
[27 Mar 2017 2:08]
Michael Buchberger
[27 Mar 2017 6:47]
Chiranjeevi Battula
Hello Michael, Thank you for the bug report. If you insert value greater than 127 you will get error, Please refer user manual for TINYINT. user manual : https://dev.mysql.com/doc/refman/5.7/en/integer-types.html Could you please provide repeatable test case (exact steps/sample code, create table statements/database details etc. - please make it as private if you prefer) to confirm this issue at our end? Thanks, Chiranjeevi.
[27 Mar 2017 11:08]
Michael Buchberger
create table, check test data
Attachment: e1370.sql (application/sql, text), 253 bytes.
[27 Mar 2017 11:09]
Michael Buchberger
C API test case
Attachment: e1370.c (text/x-csrc), 1.44 KiB.
[27 Mar 2017 11:21]
Michael Buchberger
sorry for the names of the attached files. error 1370 has nothing to do with this case. I used them erroneously due to another simultaneously reported bug.
[27 Mar 2017 11:43]
Chiranjeevi Battula
Hello Michael, Thank you for your feedback. You are trying to insert value 128. As per user manual we can insert values between "-128" to "127". Thanks, Chiranjeevi.
[27 Mar 2017 12:14]
Michael Buchberger
The user manual allows -128 to 127 for signed values and 0 to 255 for unsigned values. Of course, the internal representation of the ranges is for both cases exactly the same, it's the question of how to interpret the 8th bit, as negative sign or as range extension. So all negative values resp. all values above 127 are not handled correctly. I have just verified this by adapting the test case to insert values 127, -122 resulting in database values 127, 0.
[28 Mar 2017 10:53]
Chiranjeevi Battula
Hello Michael, Thank you for your feedback and test case. Verified this behavior as described. Thanks, Chiranjeevi.