Bug 160274 - How Base handles auto increment during table creation
Summary: How Base handles auto increment during table creation
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.0 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-19 12:27 UTC by prrvchr
Modified: 2024-03-19 15:22 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description prrvchr 2024-03-19 12:27:25 UTC
Description:
Hi all,

I can't manage to create a table with an auto increment that is not the primary key with Base.

Some databases do not require that the column which is declared as auto increment necessarily be the primary key.

Base doesn't know how to do this, or maybe I'm using it wrong...

Steps to Reproduce:
Try to create a table in Base with a column declared as auto increment and which is not the primary key.


Actual Results:
I can't do it

Expected Results:
I can do it


Reproducible: Always


User Profile Reset: No

Additional Info:
Maybe this problem has something to do with bug #156513[1], but I can't really understand bug #156513.

[1] https://bugs.documentfoundation.org/show_bug.cgi?id=156513
Comment 1 prrvchr 2024-03-19 14:22:49 UTC
Looking more closely, it seems that the choice that an auto increment is necessarily the primary key is made in this code [1] and [2].

All this is done based on the AutoIncrementIsPrimaryKey option which is true by default [3]

Although by putting this option (AutoIncrementIsPrimaryKey) with a false value in my Driver.xcu file I cannot get the functionality which seems correct to me if I look at the code!!!


[1] https://github.com/LibreOffice/core/blob/master/dbaccess/source/ui/tabledesign/TEditControl.cxx#L577
[2] https://github.com/LibreOffice/core/blob/master/dbaccess/source/ui/tabledesign/TEditControl.cxx#L1536
[3] https://github.com/LibreOffice/core/blob/master/connectivity/source/commontools/dbmetadata.cxx#L312
Comment 2 prrvchr 2024-03-19 15:22:39 UTC
Well I think I found it, it comes from a bad configuration of my Drivers.xcu

The AutoIncrementIsPrimaryKey option must be under the "MetaData" xml node (lcl_getDriverSetting) and not under the "Properties" xml node (lcl_getConnectionSetting)

Ok, I'm closing.