Bug 150338 - VARCHAR concatenation error with embedded Firebird Base LO version 7.3.5 on macOS
Summary: VARCHAR concatenation error with embedded Firebird Base LO version 7.3.5 on m...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.3.5.2 release
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: notBibisectable, regression
Depends on:
Blocks:
 
Reported: 2022-08-11 04:25 UTC by frofa
Modified: 2022-08-25 06:45 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample Firebird Base file to show field concatination problem (3.02 KB, application/vnd.oasis.opendocument.database)
2022-08-11 05:13 UTC, frofa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description frofa 2022-08-11 04:25:00 UTC
Description:
I am using Base on Mac OS  'Catalina' version 10.15.7. Having just upgraded my local LibreOffice instal from version 7.3.3 to v. 7.3.5 I find that one of my Base FORMS with a LIST BOX throws an error when the form is opened. Basically, the listbox allows a client name to be selected using a drop-down and the SQL code for the listbox concatenates the client's last and first names and the client ID (integer) is written to a filter table (to show that client's records in the form.

The listbox code is:
SELECT COALESCE ( "lastname", '' ) || ', ' || COALESCE ( "firstname", '' ), "id_cl" FROM "clients" ORDER BY "lastname" ASC

The above code worked fine with Base in LO 7.3.3 but throws the ERROR message below with LO 7.3.5...

firebird_sdbc error:
*arithmetic exception, numeric overflow, or string truncation
*string right truncation
*expected length 34, actual 69
caused by
'isc_dsql_fetch'

The last name and first name columns of the clients table are both VCHAR(16). If I change them both to VCHAR(50) the error changes also to..
*expected length 102, actual 205

So mathematically the 'actual' value in the error message above seems to be twice expected length+1

.... which does seem little strange!

NOTE: The same error above occurs when I use the above-quoted query code just as a normal query in the Base QUERIES list (i.e. not as a list-box code).

I have also tried simple concatenation of the last name and first name fields which produce the same error.

When I revert back to LO v.7.3.3, the above problem goes away and the query gives the correct concatenation of LASTNAME and FIRSTNAME. I will attach a sample Firebird embedded Base file to demonstrate the problem.

I have posted a description of this problem on ask.libreoffice.org - see LINK BELOW....

https://ask.libreoffice.org/t/form-listbox-firebird-sql-error-base-7-3-5/80265

....and tried all the things suggested there so far. The only thing that works is reverting back to the earlier version of LibreOffice. So this does seem like a bug only affecting the Mac version and versions of LO Base after version 7.3.3.

Steps to Reproduce:
1. Run query to concatenate lastname and firstname (for listbox) - see above in my DESCRIPTION of the problem.

Actual Results:
Error message (see above in my description)

Expected Results:
Concatenation of lastname and firstname (with comma separation)


Reproducible: Always


User Profile Reset: No



Additional Info:
I tried all suggestions given by 'Ask LibreOffice' helpers and nothing worked. I believe the problem might also be present in LO Bose 7.3.4.2 (only tested once and didn't take notes).
Comment 1 frofa 2022-08-11 05:13:31 UTC
Created attachment 181697 [details]
Sample Firebird Base file to show field concatination problem

To demonstrate the problem, this Base file has one query to concatenate LASTNAME and FIRSTNAME columns
Comment 2 Robert Großkopf 2022-08-11 06:09:25 UTC
Seems to be a special Mac-bug. Couldn't reproduce it with OpenSUSE 15.3 64bit rpm Linux and LO 7.3.5.2, also 7.4.0.2.
Alex, could you have a look?
Comment 3 Alex Thurgood 2022-08-24 14:41:00 UTC
Confirming with 

Version: 7.3.5.2 / LibreOffice Community (aarch64)
Build ID: 184fe81b8c8c30d8b5082578aee2fed2ea847c01
CPU threads: 8; OS: Mac OS X 12.5; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

and test file provided by OP.


The problem is not reproducible with Intel x64 build (the query functions correctly)

Version: 7.4.0.1 / LibreOffice Community
Build ID: 43e5fcfbbadd18fccee5a6f42ddd533e40151bcf
CPU threads: 8; OS: Mac OS X 12.5; UI render: Skia/Metal; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded

It would appear that the bug is linked to aarch64 for Arm, at a guess due to some incorrect compile-time switch for the Firebird code (endian-ness issue?).

@cloph : any ideas ?
Comment 4 Alex Thurgood 2022-08-24 14:46:31 UTC
> It would appear that the bug is linked to aarch64 for Arm, at a guess due to
> some incorrect compile-time switch for the Firebird code (endian-ness
> issue?).
> 
> @cloph : any ideas ?


My bad, OP is on Catalina, so using Intel arch version of LO, i.e. not specific to aarch64 M1 build.

Just a normal regression, which appears to have been fixed in 7.4 ?

@frofa : can you try a 7.4 release and report back ?

We are plagued by repeated macOS version bugs even mid-life of a branch, this is pretty much a reflection of the poor development state of the macOS builds.
Comment 5 frofa 2022-08-25 06:25:00 UTC
Tried the latest version of LO 7.4.03 Base, and happy to report the problem has been fixed (fingers crossed).
Comment 6 Robert Großkopf 2022-08-25 06:45:59 UTC
(In reply to frofa from comment #5)
> Tried the latest version of LO 7.4.03 Base, and happy to report the problem
> has been fixed (fingers crossed).

So let us set this one to WORKSFORME.

Nobody has fixed anything here, so nobody knows which change has changed the behavior.

Feel free to reopen, if the behavior appears again in LO 7.4.*