Bug 126281 - Data corruption of firebird numeric and decimal fields.
Summary: Data corruption of firebird numeric and decimal fields.
Status: RESOLVED DUPLICATE of bug 123591
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.2.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-08 03:54 UTC by mike60992
Modified: 2019-07-10 11:32 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mike60992 2019-07-08 03:54:37 UTC
Data may be corrupted when coping data into numeric and decimal fields in the firebird database. These fields may also be corrupted when migrating from a HSQLDB databases.

Steps:
Created a table with the following schema:
CREATE TABLE "Table1" (ID INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
        "Numeric" NUMERIC(15, 4),
        "Decimal" DECIMAL(15, 4),
        "Double" DOUBLE PRECISION,
PRIMARY KEY (ID));

Created a calc sheet with the following data:
ID   Numeric  Decimal  Double
1      1        2        3
2      1.1      2.1      3.1
3      1.12     2.12     3.12
4      1.123    2.123    3.123
5      1.1234   2.1234   3.1234
6      1.12345  2.12345  3.12345

Selected the calc sheet and pasted it into the firebird table.
This resulted in the firebird table containing the following unexpected data:
ID   Numeric   Decimal   Double
1    0.0001    0.0002     3
2    0.0001    0.0002     3.1
3    0.0001    0.0002     3.12
4    0.0001    0.0002     3.123
5    0.0001    0.0002     3.1234
6    0.0001    0.0002     3.1235

Repeating the above with a similarly configured HSQLDB database resulted in the expected results.

Similar issues exist when the numeric and decimal fields are migrated to the firebird database
Used the above HSQLDB database and loaded it with the following data:
ID   Numeric   Decimal   Double
1     10.1      10.1      10.1
2     10.2      10.2      10.2
3     10.3      10.3      10.3
4     10.4      10.4      10.4
5     10.5      10.5      10.5
6     10.6      10.6      10.6

Closed the database, opened and migrated it to the firebird database.
This resulted in the firebird table containing the following unexpected data:
ID   Numeric     Decimal    Double
1   -1667.6216  -1667.6216   10.1
2   -1667.5216  -1667.5216   10.2
3   -1667.4216  -1667.4216   10.3
4   -1667.3216  -1667.3216   10.4
5   -1667.2216  -1667.2216   10.5
6   -1667.1216  -1667.1216   10.6


LibreOffice Version 6.2.4.2
LibreOffice Version 6.2.5.2
Linux Mint19

Possibly related issues:
126268
123591
116893
Comment 1 Robert Großkopf 2019-07-08 13:31:25 UTC
Could confirm the buggy behaviour with 
Version: 6.3.0.0.beta2
Build-ID: 6c6edded7133daf2d8d0b2ea7ae25b8109c5c064
on OpenSUSE 15 64bit rpm Linux

Note: 
If you set NUMERIC(15, 4) it will be all 0.0001
If you set NUMERIC(15, 5) it will be all 0.00001
... and the same behaviour for DECIMAL. 

Could be this is the reason:
-------------
NUMERIC(4) stored as      SMALLINT (exact data)
NUMERIC(4,2)              SMALLINT (data * 10^2)
NUMERIC(10,4) (Dialect 1) DOUBLE PRECISION
              (Dialect 3) BIGINT (data * 10^4 )
-------------
See Firebird 2.5 Language Reference
Comment 2 MM 2019-07-08 19:58:54 UTC
Looks like a dup from bug 126268
Comment 3 Xisco Faulí 2019-07-10 11:32:52 UTC
Hello,
The problem when copying from Calc to Base is the same as in bug 123591 ( I have a fix for this in gerrit ). The migration problem is covered by bug 126268.
Closing as DUPLICATED

*** This bug has been marked as a duplicate of bug 123591 ***