Bug 138238 - Field length changes unintentionally when defining a composite key made of multiple non-consecutive fields
Summary: Field length changes unintentionally when defining a composite key made of mu...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.4.6.2 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-15 16:22 UTC by algonzal
Modified: 2022-11-06 16:39 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Short demo showing the bug (3.39 MB, video/mp4)
2020-11-15 16:25 UTC, algonzal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description algonzal 2020-11-15 16:22:27 UTC
Description:
I faced this problem when creating a table in design mode with multiple columns and different column types (more concretely, field lengths). Composite is made of multiple columns, with columns in between composite key members (composite key made of non-consecutive fields). If all fields are consecutive everything works as expected.

The issue shows up in LO v6.4.6.2 (Linux), v6.4.7.2 (Windows 10, fresh install) and v7.0.3.1 (again, Windows 10 fresh install). Using Java 8 (251). All systems are 64 bits.

Steps to Reproduce:
1. Create a new database.
2. Create a new table in design mode (do not save it).
3. Define a column (e.g. name it "col1", name does not matter) with VARCHAR type and length restricted to 9 characters.
4. Define another column (e.g. name it "col2", again, name does not matter) with SMALLINT type.
5. Define another column (e.g. name it "col3") with FLOAT type.
6. Define another column (e.g. name it "col4") with TINYINT type.
7. Select columns: col1, col2 and col4 (skipping col3), in that concrete order (when selecting them in reverse order, it works without issues).
8. Mark the 3 selected fields as primary key (composite key).
9. Check col1 length, it is 3, instead of 9.



Actual Results:
The length of col1 is 3, which matches the length of the last selected field. When selecting columns in reverse order it is 9 (because it picks the length of the latest selected column).

Expected Results:
The length of the first column should remain unchanged (9) after defining the composite key of the table.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.7.2 (x64)
Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5
CPU threads: 24; OS: Windows 10.0 Build 19041; UI render: default; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 1 algonzal 2020-11-15 16:25:03 UTC
Created attachment 167313 [details]
Short demo showing the bug
Comment 2 Robert Großkopf 2020-11-30 19:21:30 UTC
Have tested this one with internal HSQLDB and LO 7.0.3.1 on OpenSUSE 15.1 64bit rpm Linux. Could confirm the buggy behavior.

The GUI will set the value for length from the last field of the chosen primary key fields. So if you want to get the right length you have to set the VARCHAR-field as last field in this group or you have to change the length after saving the table.

Could be this is a bug inherited from OOo …