Bug 157357 - Autonumber indexing error on required fields
Summary: Autonumber indexing error on required fields
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.1.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-20 21:35 UTC by gshockxcc
Modified: 2023-09-21 06:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Open the attached database. Write a complete row. Change row. Now try only "Forename". (2.46 KB, application/vnd.oasis.opendocument.database)
2023-09-21 06:22 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gshockxcc 2023-09-20 21:35:17 UTC
When editing a table, if a field that is designated as required is not populated, an error message pops up that a required field has not been filled in.  The error is that when the dialog box is closed, the Autonumber function increments, such that the primary key ID will increment without adding a new record, however, the incremented value is not displayed until the next row is entered or the table is saved.  For each error message that occurs, the Autonumber will increment +1.  For a particular row in the table, if there are 5 attempts to move beyond a required field, that results in 5 error messages, which will have the effect of indexing the Autonumber +5 for a single row.  This makes the numbering sequence out of sync by the number of error messages that have popped up or been displayed.  The next row will continue to have the same delta, i.e. +5 from the last value.

A temporary workaround is to turn off the Autonumber, close the table, save, reopen in edit mode, and turn on the Autonumber.  This appears to clear the counter and allows the Autonumber to increment correctly from the previous value.
Comment 1 Robert Großkopf 2023-09-21 06:22:19 UTC
Created attachment 189730 [details]
Open the attached database. Write a complete row. Change row. Now try only "Forename".

Bug seems to be a very old bug. Could see it also with LO 7.4.7.2, but it is a buggy behavior of the database driver.
Table has been created with all fields required. Sending a row to this table to save the data will automatically ask for new autoincremented value. After the value has been asked for there will be detected: Oh, there are some values missed, we can't save data …
This behavior is the same in internal HSQLDB and internal Firebird. Trying to insert the row (with completed values) next time will ask for the next autoincremented value.

I tried the same with MariaDB. 
With direct connection and missing content for a field there will be inserted a (not defined) default value. "Input required" has been changed to "Input nonsense".
With JDBC connection and missing content it produces an error. After filling fields it will save the data with right autoincremented value. So the values will look like 1,2,3,4 instead of 1,3,6,9 when using internal HSQLDB and Firebird.
Comment 2 Robert Großkopf 2023-09-21 06:25:31 UTC
Same behavior with LO 7.1.5.2 and internal HSQLDB. Seems it never worked well.

Remember: GUI will offer the way to input data through forms. Form fields could also be set to "Input required". This will be controlled by GUI before submitting data. So autoincremented values will look well here.