Bug 61871 - EDITING: Query of a multiplication with fields of two tables don't refresh.
Summary: EDITING: Query of a multiplication with fields of two tables don't refresh.
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Queries
  Show dependency treegraph
 
Reported: 2013-03-05 18:21 UTC by Robert Großkopf
Modified: 2023-12-05 20:55 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Two queries - one doesn't refresh the multiplication, the other does. (4.20 KB, application/vnd.oasis.opendocument.base)
2013-03-05 18:21 UTC, Robert Großkopf
Details
Query without update in "sum" after enter a new row. (20.95 KB, image/png)
2013-03-06 21:16 UTC, Robert Großkopf
Details
Query with update in "sum" after entering a new row. (19.37 KB, image/png)
2013-03-06 21:17 UTC, Robert Großkopf
Details
Firebird embedded database (6.50 KB, application/vnd.sun.xml.base)
2023-12-05 19:23 UTC, jcsanz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2013-03-05 18:21:36 UTC
Created attachment 75979 [details]
Two queries - one doesn't refresh the multiplication, the other does.

Following query in the attached database don't refresh the field "sum", when a new input in "count" and "goods_ID" is made:
SELECT "sale".*, "goods".*, "goods"."price" * "sale"."count" AS "sum" FROM "sale", "goods" WHERE "sale"."goods_ID" = "goods"."ID"
All fields of "sale" and "goods" are shown, not the content of the multiplication-field "sum".

This query works:
SELECT "a".*, ( SELECT "price" * "a"."count" FROM "goods" WHERE "a"."goods_ID" = "ID" ) AS "sum" FROM "sale" AS "a"
All fields of "sale" are shown, new values could be added and the "sum" is refreshed automatically in the correlated subquery. But this query doesn't work in LO 4.* - there isn't shown any content of a subquery, see bug
https://bugs.freedesktop.org/show_bug.cgi?id=61166
Comment 1 Lionel Elie Mamane 2013-03-06 17:21:44 UTC
Cannot reproduce with 4.0.2.0+ (my own development tree, which has some of my commits to 4.1 backported)

Or maybe I didn't understand what you meant. Please post more detailed instructions.

For me, both queries refresh correctly when I press the "refresh" button on the toolbar (a round arrow in antitrigonometric direction, that is the same direction as the hands of a watch).

1) I open both tables and both queries
2) I add lines to "sale" table (pay attention that the line is added only after the pencil at the left disappears)
3) I press refresh on both queries
4) they both have a new line

The same with changing a line instead of adding one.
Comment 2 Robert Großkopf 2013-03-06 20:08:21 UTC
(In reply to comment #1)
Hi Lionel,
> 
> For me, both queries refresh correctly when I press the "refresh" button on
> the toolbar (a round arrow in antitrigonometric direction, that is the same
> direction as the hands of a watch).

When you press the button it works. But when you move through the data by tab and with keys the field "sum" would not be refreshed when saving the data.
> 
> 1) I open both tables and both queries
> 2) I add lines to "sale" table (pay attention that the line is added only
> after the pencil at the left disappears)
> 3) I press refresh on both queries

3) I wouldn't do. I wanted to use this query for a form and will add data in a tablecontrol by keyboard and without mouse ...
> 4) they both have a new line

New line is right, but with tab saving by jumping to the next record the field "sum" will be empty.
Comment 3 Lionel Elie Mamane 2013-03-06 20:21:38 UTC
(In reply to comment #2)
> (In reply to comment #1)

>> For me, both queries refresh correctly when I press the "refresh" button on
>> the toolbar (a round arrow in antitrigonometric direction, that is the same
>> direction as the hands of a watch).

> When you press the button it works. But when you move through the data by
> tab and with keys the field "sum" would not be refreshed when saving the
> data.

Still cannot reproduce, with LibreOffice 3.5.4.2 (Debian package).

From the Query view, I change the "count" field, then press the down arrow (or tab as many times as necessary to go to next record/line). In both queries, the sum field of the line I just left is updated.

Please give excruciatingly detailed reproduction steps.
Comment 4 Robert Großkopf 2013-03-06 21:15:37 UTC
Open query sum_no_sum_refresh. 
Input new "count", "goods_ID" (max. value 2). 
Go to next row with the arrow-keys or with tab. 
The field "sum" is empty - here with LO 3.5.*, 3.6.*, 4.0.* (all rpm-32bit) - also with win7, LO 3.6.*. The field shows 0 with LO 3.3.4.

Open query sum_with_sum_refresh. Do the same. "sum" would filled in the field, when you enter the next new row.

I will attach two screenshots of the queries - one without value in the field "sum", one of the other query.
Comment 5 Robert Großkopf 2013-03-06 21:16:36 UTC
Created attachment 76047 [details]
Query without update in "sum" after enter a new row.
Comment 6 Robert Großkopf 2013-03-06 21:17:17 UTC
Created attachment 76048 [details]
Query with update in "sum" after entering a new row.
Comment 7 Lionel Elie Mamane 2013-03-06 21:40:07 UTC
OK, I get it now, reproduced.
Comment 8 Alex Thurgood 2015-01-03 17:39:04 UTC Comment hidden (no-value)
Comment 9 QA Administrators 2016-01-17 20:04:00 UTC Comment hidden (obsolete)
Comment 10 Robert Großkopf 2016-01-29 15:07:52 UTC
Bug still exists with LO 5.1.0.3, OpenSUSE 42.1 Leap, 64bit rpm Linux.
Comment 11 Robert Großkopf 2016-03-05 18:20:36 UTC
Have tested this one with the first LO 3.3.0 - same bug. So I set the version to "Inherited FROM OOo"
Comment 12 QA Administrators 2017-03-06 15:36:28 UTC Comment hidden (obsolete)
Comment 13 Robert Großkopf 2017-03-08 17:51:19 UTC
Bug still exists with LO 5.3.1.1, OpenSUSE 42.1 Leap, 64bit rpm Linux.
Comment 14 QA Administrators 2018-03-09 03:46:05 UTC Comment hidden (obsolete)
Comment 15 Robert Großkopf 2018-03-09 07:12:14 UTC
Bug still exists with LO 6.0.2.1, OpenSUSE 42.3 Leap, 64bit rpm Linux.
Comment 16 QA Administrators 2019-12-04 04:20:58 UTC Comment hidden (obsolete)
Comment 17 Alex Thurgood 2019-12-04 07:35:55 UTC
Bug still present in 

Version: 6.3.3.2
Build ID: a64200df03143b798afd1ec74a12ab50359878ed
Threads CPU : 8; OS : Mac OS X 10.14.6; UI Render : par défaut; VCL: osx; 
Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
Calc: threaded
Comment 18 QA Administrators 2021-12-04 04:43:49 UTC Comment hidden (obsolete)
Comment 19 Robert Großkopf 2021-12-04 07:20:21 UTC
Bug still exists in LO 7.2.3.2 on OpenSUSE 15.2 64bit rpm Linux
Comment 20 QA Administrators 2023-12-05 03:16:57 UTC Comment hidden (obsolete)
Comment 21 Robert Großkopf 2023-12-05 06:43:39 UTC
Bug still exists in
Version: 24.2.0.0.alpha1 (X86_64) / LibreOffice Community
Build ID: 06946980c858649160c634007e5fac9a5aa81f38
CPU threads: 6; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Comment 22 jcsanz 2023-12-05 19:23:06 UTC
Created attachment 191259 [details]
Firebird embedded database

It seems to be a specific problem with HSQLDB, I've tested with a Firebird database (converted from the original HSQL) and the problem is not shown, that is the field refresh adequately.

Version: 7.6.3.2 (X86_64) / LibreOffice Community
Build ID: 29d686fea9f6705b262d369fede658f824154cc0
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: es-ES
Calc: CL threaded
Comment 23 jcsanz 2023-12-05 19:33:46 UTC
Also I think the sum_no_sum_refresh query is not entirely correct, because return two fields with the same name that are not particularized. May be it can be done in some databases but should be avoided.
Comment 24 Robert Großkopf 2023-12-05 19:53:16 UTC
(In reply to jcsanz from comment #23)
> Also I think the sum_no_sum_refresh query is not entirely correct, because
> return two fields with the same name that are not particularized. May be it
> can be done in some databases but should be avoided.

That is what GUI offers you. It won't work in direct SQL and won't work as view, but it will work with Base GUI.
Comment 25 Robert Großkopf 2023-12-05 19:59:40 UTC
I could reproduce the bug with the attached Firebird database. New row, '3' in field "count", '2' in field "goods_ID" and then down to next row.

2 bugs appear: Field "sum" will be empty and field "ID" (first "ID" from table "sale") will show '0' instead of '3'. So the field for AutoValue won't be refreshed. Think I have seen this before in a bug description.
Comment 26 jcsanz 2023-12-05 20:55:37 UTC
It refresh correctly if you change some values in a existing field, so perhaps title should be change to reflects "on adding records"