Firebird SDBC error: srting right truncation, expected length doesn't follow the settings

I got this error when filling a text box:

firebird_sdbc error:
*arithmetic exception, numeric overflow, or string truncation
*string right truncation
*expected length 50, actual 64
caused by
'isc_dsql_execute'
 at /usr/src/debug/libreoffice-still/libreoffice-7.5.7.1/connectivity/source/drivers/firebird/Util.cxx:6

I set it up with a text limit of 300, yet the error still appears. Is this a bug, or am I missing something?


Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Flatpak
Calc: threaded

  1. There must be something wrong between the error and the version you report: The version seems to be 7.5.7.1 in the error and 7.6.2.1 is the version you have copied. Which version do you really use with Firebird?
  2. With which version did you create the database?
  3. I have tested this with a new table. Set a field as varchar(20). Typed in some content. When typing 22 characters it fails. Reopened the table for editing and set the field to varchar(25). Could now input the data with 22 characters. Could you upload an example?

By the way: There is no hint for the LibreOffice version in the error in LO 7.6.2.1 here (OpenSUSE 15.4 64bit rpm Linux). It looks like this:

firebird_sdbc error:
*arithmetic exception, numeric overflow, or string truncation
*string right truncation
*expected length 25, actual 27
caused by
'isc_dsql_execute'
 at /home/buildslave/source/libo-core/connectivity/source/drivers/firebird/Util.cxx:69

Hello, RobertG! Thanks a lot for replying!

  1. You’re right! I tried with both LibreOffice Still (7.5.7.1) and Flatpak (7.6.2.1). I usually use Flatpak for LO Base because of the wizard to create reports, which I think I remember it requires Java. Where can I find the number of Firebird version? I’m looking online and not founding anything.
  2. It’s an almost 2 years old database I made with back then LibreOffice still, I can’t remember the version.
  3. That’s interesting! How can I change the type, so I can set it up just like you did? Here is my “emptied” database; the text box where I found this issue it’s at FormsClientesRazón Social (yes, I use it in Spanish).

You have changed the length for the field in the form, not for the field of the table in the database. Form fields could be set to ‘0’. Have a look at other fields. ‘0’ means: No limit for the field.

You have to open the table for editing, not for input data:


Have marked the field “RazónSocial”.
Have a look at the bottom of the editor.
Length is set to 50.
Switch this value to the value you need.
Save the table and it should work in the form also.

1 Like

Hi again! Seems like this was more complicated than that, sorry to bring this issue again. I’m trying to open the table vReportQuery, but I get this error:

The data content could not be loaded. at /run/build/libreoffice/connectivity/source/commontools/dbtools.cxx:746
Error code: 1

firebird_sdbc error:
*arithmetic exception, numeric overflow, or string truncation
*string right truncation
*expected length 50, actual 65
caused by
'isc_dsql_fetch'
 at /run/build/libreoffice/connectivity/source/drivers/firebird/Util.cxx:69

The current limit for RazónSocial is set at 500.

This is the SQL view:

select
	f."IDFactura", f."FechaFactura", f."Estado", f."FacturaHecha", f.yr,
	right('00'  || cast(f.grp_pos as varchar(10)), 3) || '/' || right(cast(f.yr as varchar(4)), 2) "IDinvoice",
	c."RazónSocial", c."Dirección", c."Ciudad", c."CódigoPostal", c."PaísORegión", c."CIF",
	t."Descripción", t."Cantidad", t."Precio"
from
(
	select
		"IDFactura", "IDCliente", "FechaFactura", "Estado", "FacturaHecha",
		row_number() over (partition by extract(year from "FechaFactura") order by "FechaFactura", "IDFactura") grp_pos,
		extract(year from "FechaFactura") yr
	from "Facturas"
) f
join
(
	select "IDCliente", "RazónSocial", "Dirección", "Ciudad", "CódigoPostal", "PaísORegión", "CIF"
	from "Clientes"
) c
	on f."IDCliente" = c."IDCliente"
join
(
	select "IDFactura", "Descripción", "Cantidad", "Precio"
	from "Tareas"
) t
	on f."IDFactura" = t."IDFactura"
order by f."FechaFactura", f."IDFactura"

EDIT:

Thanks to ChatGPT I could update the SQL and now it works :tada: (I am keeping a backup just in case, I don’t trust that much the coding abilities of ChatGPT):

SELECT
    f."IDFactura", f."FechaFactura", f."Estado", f."FacturaHecha", f.yr,
    RIGHT('00' || CAST(f.grp_pos AS VARCHAR(10)), 3) || '/' || RIGHT(CAST(f.yr AS VARCHAR(4)), 2) AS "IDinvoice",
    c."RazónSocial", c."Dirección", c."Ciudad", c."CódigoPostal", c."PaísORegión", c."CIF",
    t."Descripción", t."Cantidad", t."Precio"
FROM
    (
        SELECT
            "IDFactura", "IDCliente", "FechaFactura", "Estado", "FacturaHecha",
            ROW_NUMBER() OVER (PARTITION BY EXTRACT(YEAR FROM "FechaFactura") ORDER BY "FechaFactura", "IDFactura") AS grp_pos,
            EXTRACT(YEAR FROM "FechaFactura") AS yr
        FROM "Facturas"
    ) f
JOIN
    (
        SELECT "IDCliente", "RazónSocial", "Dirección", "Ciudad", "CódigoPostal", "PaísORegión", "CIF"
        FROM "Clientes"
    ) c ON f."IDCliente" = c."IDCliente"
JOIN
    (
        SELECT "IDFactura", "Descripción", "Cantidad", "Precio"
        FROM "Tareas"
    ) t ON f."IDFactura" = t."IDFactura"
ORDER BY f."FechaFactura", f."IDFactura";