Bug #111006 DOUBLE type in database has 6 digit precision despite double type capable of 15,
Submitted: 11 May 2023 20:22 Modified: 31 May 12:52
Reporter: Rich Lowe Email Updates:
Status: Need Feedback Impact on me:
None 
Category:Connector / C++ Severity:S1 (Critical)
Version:8.0 latest build as of 5/11/23 OS:Windows
Assigned to: MySQL Verification Team CPU Architecture:x86

[11 May 2023 20:22] Rich Lowe
Description:
DOUBLE data type in MySQL table only retrieves six significant digits no matter what you do in MySQL Connector C++ 8.0 library.  It should be capable of reading the full double, and should by default IMO, but I have found no mechanism to do so and it is not that way by default.

How to repeat:
insert a number like 15.12345678912345 into a MySQL column of DOUBLE type
read it back using mysql Node.js npm library you get 15.12345678912345
read it back using Connector C++ 8.0 library you get 15.12340000000000

Suggested fix:
Read full double value from server in Connector C++ 8.0
[11 May 2023 20:26] Rich Lowe
Correction, I believe it is the insert side where the mistake is occurring.

It should insert full double value instead of just 6 significant digits.
[11 May 2023 20:27] Rich Lowe
Node.js example code using MySQL npm library by way of mysql-await library

Attachment: Node.js code.png (image/png, text), 72.72 KiB.

[11 May 2023 20:27] Rich Lowe
Node.js output showing full double value returned

Attachment: Node.js output.png (image/png, text), 17.57 KiB.

[11 May 2023 20:36] Rich Lowe
C++ example code

Attachment: cpp-code.png (image/png, text), 209.31 KiB.

[11 May 2023 20:36] Rich Lowe
C++ example output

Attachment: cpp-output.png (image/png, text), 4.03 KiB.

[11 May 2023 20:40] Rich Lowe
C++ test output with no insert, just select of Node.js inserted double

Attachment: test output only selecting node.js inserted double.png (image/png, text), 7.73 KiB.

[11 May 2023 20:41] Rich Lowe
Select from MySQL workbench of C++ inserted double

Attachment: select of C++ inserted double.png (image/png, text), 88.84 KiB.

[11 May 2023 20:41] Rich Lowe
Select from MySQL workbench of Node.js inserted double

Attachment: select of node.js inserted double.png (image/png, text), 109.99 KiB.

[11 May 2023 20:43] Rich Lowe
Ok, I have confirmed.

Who Inserts | Who Reads | They Get
C++ | C++ | truncated
C++ | Node.js or MySQL Workbench | truncated
Node.js | Node.js | full 15 decimals
Node.js | C++ | truncated
Node.js | MySQL Workbench | full 15 decimals

I would expect no truncation in any instances for DOUBLE values.
[11 May 2023 20:49] Rich Lowe
No, sorry, I made a mistake.  I did not have setprecision in my C++ read examples except on the DIFF version.  The problem is only on the insert side.

I have re-confirmed.

Who Inserts | Who Reads | They Get
C++ | C++ | truncated
C++ | Node.js or MySQL Workbench | truncated
Node.js | Node.js | full 15 decimals
Node.js | C++ | full 15 decimals
Node.js | MySQL Workbench | full 15 decimals

I would expect no truncation in any instances for DOUBLE values.

Apologies for all of my corrections.
[11 May 2023 20:54] Rich Lowe
Double selected by C++  from (top) Node.js inserted double (bottom) C++ inserted double

Attachment: final example where double selected in C++ inserted from a. node.js and b. c++.png (image/png, text), 32.08 KiB.

[31 May 12:52] MySQL Verification Team
Hello!

Thank you for the bug report.
Please upgrade to latest version and report us back if issue persist even in latest version along with test case. Thank you.

Regards,
Ashwini Patil