Bug 133994 - FIREBIRD: Query with BETWEEN destroys connection to internal Firebird database
Summary: FIREBIRD: Query with BETWEEN destroys connection to internal Firebird database
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.4.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-15 06:47 UTC by Robert Großkopf
Modified: 2022-11-29 07:47 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Open the attached database. You could ignore macros. Open query "internal ..." (33.12 KB, application/vnd.oasis.opendocument.database)
2020-06-15 06:47 UTC, Robert Großkopf
Details
Screenshot of the error, which destroys connection to internal Firebird (79.91 KB, application/pdf)
2020-06-15 06:48 UTC, Robert Großkopf
Details
bt with debug symbols (24.46 KB, text/plain)
2020-11-15 16:17 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2020-06-15 06:47:28 UTC
Created attachment 162003 [details]
Open the attached database. You could ignore macros. Open query "internal ..."

I'm converting some example-database from HSQLDB to Firebird for showing the difference in code between this two internal databases.

Open the attached database.
Have a look at the tables - content is there.
Go to queries and start the query internal_FB_consistency_check.
You will get an error like shown in the second attached screenshot.
Close the dialog with "OK", close the query without content.

Have a look at the tables - no content is available any more. Same content in the dialog than before: 
Internal consistency check ...

A code of a query should never be able to disconnect a (internal) database. This never happens with the internal HSQLDB. A warning like "I don't know what you mean with this code" is the standard here and all functionality is available.

This bug appears with LO 6.4.4.2 on OpenSUSE 15.1 64bit rpm Linux.
Comment 1 Robert Großkopf 2020-06-15 06:48:20 UTC
Created attachment 162004 [details]
Screenshot of the error, which destroys connection to internal Firebird
Comment 2 Robert Großkopf 2020-06-15 09:50:42 UTC
Have found the reason in the code.
If I write this:

SELECT "a"."Datum" FROM "Ansicht_Datum_lfdNr" AS "a" WHERE "a"."Datum" BETWEEN '2020-01-01' AND '2020-12-31'

Firebird database will disconnect

and if I get the same with
SELECT "a"."Datum" FROM "Ansicht_Datum_lfdNr" AS "a" WHERE "a"."Datum" >= '2020-01-01' AND "a"."Datum" <= '2020-12-31'

Firebird will work as expected. But Firebird should know what "BETWEEN" is. It is content of the docs of Firebird - and the alternative I wrote down is shown there also as the possibility to get the same result.
Comment 3 Alex Thurgood 2020-06-16 11:04:13 UTC
If I try this with 

Version : 6.4.4.2
Build ID : 3d775be2011f3886db32dfd395a6a6d1ca2630ff
Threads CPU : 8; OS : Mac OS X 10.15.4; UI Render : par défaut; VCL: osx; 
Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
Calc: threaded

I see the tables list slowly disappearing as I choose a table from the list after clearing the preceding error message, until LO finally crashes.

Confirming.
Comment 4 Julien Nabet 2020-11-15 16:17:14 UTC
Created attachment 167312 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I reproduced the crash by launching LO and just launch SQL with:

SELECT "a"."Datum" FROM "Ansicht_Datum_lfdNr" AS "a" WHERE "a"."Datum" BETWEEN '2020-01-01' AND '2020-12-31'

Just for curiosity, do you reproduce an error or kind of crash by testing directly on Firebird if you create the same tables and view?
Comment 5 Julien Nabet 2020-11-15 16:20:01 UTC
I gave a try with:
SELECT "a"."Startdatum" FROM "Reservierung" AS "a" WHERE "a"."Startdatum" BETWEEN '2020-01-01' AND '2020-12-31'

So the pb seems to be the use of "BETWEEN" on a view.
Comment 6 Julien Nabet 2020-11-15 16:20:52 UTC
(In reply to Julien Nabet from comment #5)
> I gave a try with:
> SELECT "a"."Startdatum" FROM "Reservierung" AS "a" WHERE "a"."Startdatum"
> BETWEEN '2020-01-01' AND '2020-12-31'
> 
> So the pb seems to be the use of "BETWEEN" on a view.

Sorry, forgot to say it worked with quoted query. (still by using Tools/SQL...)
Comment 7 Robert Großkopf 2020-11-15 17:17:08 UTC
I have tried it with the same database as external file. Same buggy behavior.

Then I tried to import the data from the internal file to a Firebird ODBC connected database. It is impossible to get both databases open the same time in LO. So I couldn't copy the content.

Then I copied the file to the server path of Firebird, but the user I have installed has no right to connect to the tables in the file. And another bug appeared: With LO 7.0.3.1 LO crashes immediately when I connect to Edit → Database → Properties

So I gave up to test if the query will work in a server-database of Firebird.
Comment 8 Julien Nabet 2020-11-15 18:24:42 UTC
(In reply to Robert Großkopf from comment #7)
> ...
> So I gave up to test if the query will work in a server-database of Firebird.
I understand.
I tried with LO Debian package 7.0.3 and master sources, each time sub entries of Edit/Database (Properties..., Connection Type..., Advanced Settings...) are disabled.
Comment 9 Julien Nabet 2020-11-15 19:11:49 UTC
(In reply to Julien Nabet from comment #8)
> (In reply to Robert Großkopf from comment #7)
> > ...
> > So I gave up to test if the query will work in a server-database of Firebird.
> I understand.
> I tried with LO Debian package 7.0.3 and master sources, each time sub
> entries of Edit/Database (Properties..., Connection Type..., Advanced
> Settings...) are disabled.

Ok it's disabled because I use embedded Firebird in LO and you were testing with LO + external server Firebird.
Comment 10 Julien Nabet 2020-11-28 19:17:34 UTC
I don't reproduce this with master sources updated today.
First I thought it may be related to Firebird upgrade to 3.0.7 but then I tested again with LO Debian package 7.0.3, quite weirdly, I don't reproduce this.

About Database properties, it's been fixed from next release 7.0.4, see tdf#138240 (or daily master or daily 7.1 branch)
Comment 11 QA Administrators 2022-11-29 03:43:34 UTC Comment hidden (obsolete)
Comment 12 Robert Großkopf 2022-11-29 07:47:17 UTC
Couldn't reproduce the bug any more with LO 7.4.3.2 on OpenSUSE 15.3 I close this one as WORKSFORME.