Bug 145900 - Firebird: copy records will copy row with max value AutoValue primarykey instead of inserted value before refreshing row
Summary: Firebird: copy records will copy row with max value AutoValue primarykey inst...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2021-11-26 13:40 UTC by mhonline
Modified: 2025-05-14 14:49 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
example (113.80 KB, image/jpeg)
2021-11-26 13:41 UTC, mhonline
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mhonline 2021-11-26 13:40:15 UTC
Description:
when using the dragdrop-feature within tableview, 
the copying is working, but displayed is a wrong one
until the view is closed an reopened.
This happens within HSQL-ODB aswell as in FB-ODB

Steps to Reproduce:
1.open any FB-table in table-view
2.select a record for being copied
3.drop it to the "+"-sign

Actual Results:
wrong record is shown
but right record stored

Expected Results:
show right record after copying


Reproducible: Always


User Profile Reset: No



Additional Info:
- - -
Comment 1 mhonline 2021-11-26 13:41:25 UTC
Created attachment 176524 [details]
example
Comment 2 mhonline 2021-11-26 14:00:35 UTC
oops - liked to edit my bugentry,as I mixed my test-files, but don't know how. 
So: This works fine with HSQL-odb, only FB-odb is faulty

mh
Comment 3 Robert Großkopf 2021-11-27 11:03:04 UTC
Have tested this with internal Firebird. Took a table with autovalue for primary key. Will work as expected if I won't change a value for a primary key to a number, which is bigger than the next inserted ID.

If I set the PK of one row to '222' and next inserted ID will be '9' it will show the row with PK 222 instead of the inserted content. You have to refresh the table to show the inserted value.

All tested with LO 7.2.3.2 on OpenSUSE 15.2 64bit rpm Linux.

Could be this bug has reported before - will have a look.
Comment 4 QA Administrators 2025-04-30 03:10:45 UTC Comment hidden (obsolete)
Comment 5 Robert Großkopf 2025-04-30 05:35:18 UTC
Bug is still the same with
Version: 25.2.3.1 (X86_64) / LibreOffice Community
Build ID: d8d1af5f77df955194e52baabe19324532ac8e8b
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Comment 6 mc 2025-05-14 13:53:58 UTC
need to ceck your .odb form

In a new .odb, new form with datagrid that show direct record of a table, the problem not occurs.
Also, if drag a record directly in a Table, coping work fine.

Check the Key field.

Tested with 
Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: bbb074479178df812d175f709636b368952c2ce3
CPU threads: 4; OS: Windows 7 Service Pack 1 X86_64 (6.1 build 7601); UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: threaded
Comment 7 Robert Großkopf 2025-05-14 14:12:44 UTC
(In reply to mc from comment #6)
> need to ceck your .odb form
> 
> In a new .odb, new form with datagrid that show direct record of a table,
> the problem not occurs.

Has nothing do do with a form.

Take any table with auto incremented value.
Might look like this:
ID Name
1   Robert
2   Bill
3   Claire

ID is auto incremented.
Change ID 2 to 20.
Click on row with ID = 1 and move to end of the table.
There will be sown as new row
20   Bill
Refresh the table
There will be shown 
4    Robert

This will appear only with Firebrid, not with HSQLDB. HSQLDB would insert the new row with
21   Robert
Comment 8 mc 2025-05-14 14:35:08 UTC
(In reply to Robert Großkopf from comment #7)
> ...
> 20   Bill
> Refresh the table
> There will be shown 
> 4    Robert
> 
> This will appear only with Firebrid, not with HSQLDB. HSQLDB would insert
> the new row with
> 21   Robert

ID Key in Firebird not work same as HSQLDB

If you manually change value of ID Key in a table, need to update the internal ID "counter" before to continue to insert other record, ex. with:
ALTER TABLE "table" ALTER COLUMN "ID" RESTART WITH 21; 

@mhonline first has showed a Form in attachment 176524 [details]
Comment 9 Robert Großkopf 2025-05-14 14:49:54 UTC
(In reply to mc from comment #8)
> (In reply to Robert Großkopf from comment #7)
> > ...
> > 20   Bill
> > Refresh the table
> > There will be shown 
> > 4    Robert
> > 
> > This will appear only with Firebrid, not with HSQLDB. HSQLDB would insert
> > the new row with
> > 21   Robert
> 
> ID Key in Firebird not work same as HSQLDB
> 
> If you manually change value of ID Key in a table, need to update the
> internal ID "counter" before to continue to insert other record, ex. with:
> ALTER TABLE "table" ALTER COLUMN "ID" RESTART WITH 21; 
> 
> @mhonline first has showed a Form in attachment 176524 [details]

I know all this - have written the German original for Base Guide. But I isn't an argument while row wouldn't be refreshed and the inserted value will be shown in the right way for Firebird. There should be shown
4   Robert
and not
20  Bill
or, better, there should be found a way for Firebird to correct the autovalue to max ID, as ist works with HSQLDB, because the current behavior will run into an error if Firebird has counted ID should be '20' and primary key '20' is used for 
20  Bill.