Bug 125165 - Firebird query: decimal fields are not handled correctly in arithmetic operations
Summary: Firebird query: decimal fields are not handled correctly in arithmetic operat...
Status: RESOLVED DUPLICATE of bug 121528
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-07 20:10 UTC by Sébastien Ducoulombier
Modified: 2019-05-09 10:12 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
A minimal Firebird database with one table and one query to test operations on decimal value (3.00 KB, application/vnd.oasis.opendocument.database)
2019-05-07 20:13 UTC, Sébastien Ducoulombier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sébastien Ducoulombier 2019-05-07 20:10:57 UTC
Description:
In Firebird Embedded databases, decimal values cannot be reliably used in arithmetic expressions in a query.

However, in the "Execute SQL Statement" window, they work as expected.

Steps to Reproduce:
1. Open the attached ODB file
2. Execute Query1

Actual Results:
In the second column, value 246 is shown.

Expected Results:
Value 2.46 is expected ( 1.23 * 2 = 2.46 )


Reproducible: Always


User Profile Reset: Yes



Additional Info:
This issue only affects Firebird Embedded databases.
It does not affect HSQLDB Embedded databases.

This issue only affects the standard query execution system.
It does not affect SQL commands executed in the "Execute SQL Statement" window :
in menu bar, open "Tools" / "SQL…" to type Query1's SQL command :
select c, c * 2 from Table1
Check "Show output of "select command"" and click "Execute".
The output is correct: 1.23,2.46

The same bug occurs with other arithmetic operators (+ - /).

The same bug occurs with constants. for example,
 1.00 * 2 returns 200
 1.00 * 12.00 returns 120000.

Column "c" has data type DECIMAL with 2 decimal places.
Table Table1 contains only one record with value 1.23 in column "c".

It looks like LibreOffice removes the input values decimal points to convert them to integers prior to the operation, but then forgets to insert it back in the resulting integer.

Checking "Run SQL comand directly" does not help.

Version: 6.1.5.2
Build ID: 90f8dcf33c87b3705e78202e3df5142b201bd805
CPU threads: 4; OS: Linux 4.9; UI render: default; VCL: gtk2; 
Locale: en-US (C); Calc: group threaded
Comment 1 Sébastien Ducoulombier 2019-05-07 20:13:39 UTC
Created attachment 151219 [details]
A minimal Firebird database with one table and one query to test operations on decimal value
Comment 2 Sébastien Ducoulombier 2019-05-09 06:21:23 UTC
Version 6.3.0.0.alpha0+ still has this bug.
Comment 3 Alex Thurgood 2019-05-09 10:11:20 UTC
Pretty certain that this is a DUP...
Comment 4 Alex Thurgood 2019-05-09 10:12:25 UTC

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