Bug 156513 - AutoIncrementIsPrimaryKey is no longer considered in Base 7.5 and above
Summary: AutoIncrementIsPrimaryKey is no longer considered in Base 7.5 and above
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-29 03:19 UTC by prrvchr
Modified: 2023-08-01 23:08 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
bt (6.98 KB, text/plain)
2023-07-30 08:10 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description prrvchr 2023-07-29 03:19:00 UTC
Description:
If in Drivers.xcu file the MetaData/AutoIncrementIsPrimaryKey node is set to true, then when you create a new table in Base if you set a column as autoincrement value, that column automatically becomes the primary key of the created table .

Steps to Reproduce:
1. Install jdbcDriverOOo extension (https://prrvchr.github.io/jdbcDriverOOo/)
2. Install SQLiteOOo extension (https://prrvchr.github.io/SQLiteOOo/)
3. Create a new SQLite embedded database and open the database for editing (https://prrvchr.github.io/SQLiteOOo/#how-to-create-a-new-database)
4. Create new table with an INTEGER autoincrement Column and an TEXT column.
5. Save this new table.

Actual Results:
If you use a version 7.5 or higher of LibreOffice, when saving the new table you will be required to create a primary key

Expected Results:
With version 7.3.7.2 declaring the column as auto increment makes it a primary key automatically.


Reproducible: Always


User Profile Reset: No

Additional Info:
I could not test the 7.4.x version.
Comment 1 Julien Nabet 2023-07-29 11:46:02 UTC
On pc Debian x86-64, I retrieved 7.3 branch so I could build 7.3.8
Then on a HSQLDB database, I created a table and put "AutoValue" to Yes, it asked about a primary key.
Is there something else to do to make it auto increment and so it doesn't ask about primary key?
Comment 2 Julien Nabet 2023-07-29 11:47:18 UTC
I may be wrong but I suppose the bug can be reproduced without installing any extension.
I mean, it's a better to have a minimal step by step process to reproduce a bug.
Comment 3 prrvchr 2023-07-29 13:48:57 UTC
I only tested with my JDBC extension (ie: jdbcDriverOOo, HsqlDriverOOo and SQLiteOOo)

What is certain is that the driver must declare to Base that the autoincrements are the primary keys (with the AutoIncrementIsPrimaryKey parameter set to true in Drivers.xcu). Otherwise, you will have to create the primary key manually.

I'm not sure that the drivers embedded in LibreOffice use the parameter: AutoIncrementIsPrimaryKey?
Comment 4 prrvchr 2023-07-29 13:51:26 UTC
I checked that if I set the AutoIncrementIsPrimaryKey parameter to false then there is no more automatic creation of primary keys.
Comment 5 Julien Nabet 2023-07-29 14:34:42 UTC
Weird, with LO 7.3.8, I opened an existing odb file containing a JDBC connection to Mariadb and gave a try but LO asked about a primary key whereas I put AutoValue to Yes.

I thought the parameter might be in the odb file so I unzipped the odb file and did:
fgrep -nR AutoIncrementIsPrimaryKey *
it found nothing.

Any way to reproduce this without installing the extensions?
Comment 6 Robert Großkopf 2023-07-29 15:14:16 UTC
Couldn't confirm any buggy behavior with internal Firebird and LO 7.5.5.1 on OpenSUSE 15.4 64bit rpm Linux.

Then tested with SQlite connected through JDBC (sqlite-jdebc-3.40.0.0.jar) and it will also work well.

When choosing "AutoValue" the field will be set to primary key.

Note: In SQLite through JDBC there won't refreshed the value, so there will be shown '0' when inserting new record, but you could insert many new records well, all shown with primary key '0' if not refreshed. This will work the same (buggy) way in older LO-Versions like LO 7.3.6.2…
Comment 7 prrvchr 2023-07-29 15:56:21 UTC
I can confirm on:

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 4:7.5.5~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded

and

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ff8ec4cfe5df1e15c3e9f6adc843dfe31358e097
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded

I have no problem with:

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: qt5 (cairo+xcb)
Locale: en-US (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.3
Calc: threaded
Comment 8 prrvchr 2023-07-29 16:09:07 UTC
> Note: In SQLite through JDBC there won't refreshed the value, so there will be
> shown '0' when inserting new record, but you could insert many new records
> well, all shown with primary key '0' if not refreshed. This will work the same
> (buggy) way in older LO-Versions like LO 7.3.6.2…

I don't have this problem with SQLiteOOo (it doesn't support updatable ResultSet), but only with HsqlDriverOOo.
Comment 9 prrvchr 2023-07-29 16:31:34 UTC
> I thought the parameter might be in the odb file so I unzipped the odb file

No apparently there is nothing recorded in the odb file concerning this parameter: AutoIncrementIsPrimaryKey

I only use it in the drivers.xcu file, I don't know more...
Comment 10 prrvchr 2023-07-29 17:25:24 UTC
It's hard for me to test with my laptop because I don't want to break everything, so I can test the versions natively:

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: qt5 (cairo+xcb)
Locale: en-US (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.3
Calc: threaded

and

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ff8ec4cfe5df1e15c3e9f6adc843dfe31358e097
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded

For all the other version, I go through VirtualBox 6.1.38 in order to preserve my configuration
Comment 11 prrvchr 2023-07-29 22:54:35 UTC
If I install libreoffice-sdbc-hsqldb package (the native embedded HsqlDB 1.8) I can confirm on:

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 4:7.5.5~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded

I have no problem with:

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: qt5 (cairo+xcb)
Locale: en-US (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.3
Calc: threaded
Comment 12 Robert Großkopf 2023-07-30 05:35:52 UTC
No problem here with internal HSQLDB, too.

LO 7.5.5.1 on OpenSUSE 15.4 64bit rpm Linux.

Version: 7.5.5.1 (X86_64) / LibreOffice Community
Build ID: 2c5e46c1980ec5241359fd65d751dc518205e7af
CPU threads: 6; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

If you are testing different versions please install version packed by LO directly, not by your distribution.
Comment 13 Julien Nabet 2023-07-30 08:10:42 UTC
Created attachment 188650 [details]
bt

On pc Debian x86-64 with master sources updated today, it works but only with gen rendering, it doesn't work with gtk3 or kf5 rendering.

I thought the primary key was set when saving the table but in fact, when putting autovalue to "Yes" and click another field, it adds the primary key.

I added a bt from isAutoIncrementPrimaryKey is called.
Comment 14 prrvchr 2023-07-30 10:07:33 UTC
> If you are testing different versions please install version packed by LO 
> directly, not by your distribution.

No Robert I wouldn't install anything more...
Did you install my extension?

I would like things to be very clear. We are not competitors, but we all work for the same free software called LibreOffice.

Years ago I opened issue I alerted you to malfunctions with HsqlDB (see https://bugs.documentfoundation.org/show_bug.cgi?id=132195)
You never followed up on this malfunction and you explained that you were turning to FireBird and that you wanted to abandon Java.

Faced with this decision, which I respect, I had no choice but to develop a JDBC driver. Realizing that I couldn't do anything good in Python, I took the trouble to learn Java and wrote a new pure Java JDBC to UNO SDBC driver.

It took me more than 2 years of development to manage to release version 1.0 with fully integrated Hsqldb and SQLite...

So certainly there must be some bugs in my driver, then it's my first Java program (and even without that...), but I managed to fix everything that didn't work in the UNO JDBC driver of LibreOffice and I even took a few years ahead of him...

So instead of explaining to me nicely that you are afraid to install this driver under the pretext of wasting time debugging it, you better install it, because there is no better tool to confirm bugs between different version of LibreOffice Base...

If you continue on this path, what is the strategy for fixing the bug 156512 (https://bugs.documentfoundation.org/show_bug.cgi?id=156512) and bug 156511 (https://bugs.documentfoundation.org/show_bug.cgi?id=156511)

I think it's high time we all work together and not against each other...
Comment 15 Julien Nabet 2023-07-30 11:32:29 UTC
Caolán: I tried to debug and saw that with gen rendering, this part is called:
SalInstanceComboBoxWithoutEdit::get_active_text()

but if export SAL_NO_MOUSEGRABS=1 allows to not block UI with gen rendering, it doesn't work with gtk3 so I don't know what is called with gtk3 (I didn't try with kf5)


Here are the steps to reproduce the bug:
- create a brand new odb file (hsqlDB embedded)
- click "Tables" pane at left
- "Create Table in Design View..."
- in Field Name, type "id", in "Field Type", choose "Integer"
- In "Autovalue" (at bottom), select "Yes"
- click on a blank row
=> a key must appear at left indicating that the field is a primary key.
With gen rendering, it works, it doesn't work with kf5 or gtk3.
(I attached bt from "isAutoIncrementPrimaryKey" with gen rendering).
Comment 16 prrvchr 2023-07-30 12:38:21 UTC
I confirm that if I install the libreoffice-qt5 package then it changes my VCL version and it works...

Work on:

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: qt5 (cairo+xcb)
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Ubuntu package version: 4:7.5.5~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded


How to get the same result: VCL: qt5 (cairo+xcb) by compiling the gerrit version?
Comment 17 prrvchr 2023-08-01 23:08:38 UTC
(In reply to Robert Großkopf from comment #6)

> Then tested with SQlite connected through JDBC (sqlite-jdebc-3.40.0.0.jar)
> and it will also work well.

I don't know if it's the same jdbc sqlite driver, but if so, it's thanks to Gotson's goodwill that we are able to manage autoincrement columns in Base.

See https://github.com/xerial/sqlite-jdbc/issues/786