Bug #84449 Signed zero not preserved by mysqldump/restore

Submitted: 9 Jan 2017 19:08 Modified: 9 Jan 2017 20:48
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:5.5/5.6/5.7/8.0 OS:Any
Assigned to: CPU Architecture:Any

[9 Jan 2017 19:08] Hartmut Holzgraefe
Description:
It is possible to insert negative signed zero into a FLOAT column in several different ways:

* INSERT(0) and INSERT(-0) both insert a positive 0
* INSERT('-0'), INSERT(-0e0) and INSERT(ROUND('-0.1')) all insert a negative signed 0

mysqldump dumps 0 and -0 correctly, but as the values are not quoted they are both restored as positive 0

How to repeat:
CREATE TABLE t1(x double);

INSERT INTO t1 VALUES (0e0),(-0e0);

SELECT x FROM t1;
+------+
| x    |
+------+
|    0 |
|   -0 |
+------+

... do mysqldump

... restore from mysqldump

SELECT x FROM t1;
+------+
| x    |
+------+
|    0 |
|    0 | <- expected -1 here
+------+

Suggested fix:
check for literal "-0" in mysqldump when processing field values for INSERT output, add quotes or convert to -0e0 in such cases to preserve zero signednes
[9 Jan 2017 20:48] MySQL Verification Team
Thank you for the bug report. Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.