Bug 132814 - EDITING: Impossible to change an existing Integer primarykey in MySQL/MariaDB to AutoValue in GUI
Summary: EDITING: Impossible to change an existing Integer primarykey in MySQL/MariaDB...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.4.3.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:7.0.0 target:6.4.5
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-07 13:23 UTC by Robert Großkopf
Modified: 2020-05-11 07:32 UTC (History)
1 user (show)

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 Robert Großkopf 2020-05-07 13:23:26 UTC
Use a MariaDB or MySQL-database for this bug.
Connection through ODBC, JDBC or direct driver give the same result.
Create a table in the GUI, two fields:
ID > INTEGER
name > VARCHAR(50)
Set ID to primary key, but not to AutoValue.
Save the table and close the table.
Open the table to input data. AutoValue isn't created.
Open the table for editing and set ID to AutoValue.
Save the table.

At this moment the bug appears: When saving the table the AutoValue will be set back from "Yes" to "No". You can't can't change a primarykey in a MySQL/MariaDB-database through the GUI form AutoValue "No" to AutoValue "Yes".

No go to Tools → SQL
ALTER TABLE `table` CHANGE `ID` `ID` INT(10) NOT NULL AUTO_INCREMENT;
The ID will be changed to AutoValue without any problem. 

Seems this bug has nothing to do with the connection to MySQL/MariaDB. Its an internal problem of the GUI.
Comment 1 Julien Nabet 2020-05-10 07:54:17 UTC
On pc Debian x86-64 with master source updated today, I could reproduce this.

I noticed that if I do the contrary, I mean creating a table with Autovalue to yes then save, then reopen to put Autovalue to No then save, no pb.
Comment 2 Julien Nabet 2020-05-10 07:59:52 UTC
In the same time, I don't reproduce this with hsqldb embedded (or did I miss something?), so not completely GUI related if not, I should have been able to reproduce this with hsqldb.
Comment 3 Julien Nabet 2020-05-10 09:17:00 UTC
code pointer:
#0  connectivity::mysql::OMySQLTable::alterColumnByName(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&)
    (this=0x35d4e70, colName="id", descriptor=uno::Reference to (dbaccess::OTableColumnDescriptorWrapper *) 0x3bb1798) at connectivity/source/drivers/mysql_jdbc/YTable.cxx:199
#1  0x00007fffdd26638a in dbaccess::ODBTableDecorator::alterColumnByName(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) (this=
    0x3a3b820, _rName="id", _rxDescriptor=uno::Reference to (dbaccess::OTableColumnDescriptorWrapper *) 0x3bb1798) at dbaccess/source/core/api/TableDeco.cxx:400
#2  0x00007fffdcbdfbab in dbaui::OTableController::alterColumns() (this=0x3cecc20) at dbaccess/source/ui/tabledesign/TableController.cxx:1035
#3  0x00007fffdcbdb539 in dbaui::OTableController::doSaveDoc(bool) (this=0x3cecc20, _bSaveAs=false) at dbaccess/source/ui/tabledesign/TableController.cxx:371
#4  0x00007fffdcbda183 in dbaui::OTableController::Execute(unsigned short, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    (this=0x3cecc20, _nId=5505, aArgs=uno::Sequence of length 1 = {...}) at dbaccess/source/ui/tabledesign/TableController.cxx:237
#5  0x00007fffdc837c7e in dbaui::OGenericUnoController::executeChecked(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    (this=0x3cecc20, _rCommand=..., aArgs=uno::Sequence of length 1 = {...}) at dbaccess/source/ui/browser/genericcontroller.cxx:1038
Comment 4 Julien Nabet 2020-05-10 09:25:19 UTC
I gave a try with https://gerrit.libreoffice.org/c/core/+/93915
Comment 5 Commit Notification 2020-05-10 10:37:25 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f8c62ed408ae9b390d8268b43f4d49c2c6057227

tdf#132814: fix put autovalue to Yes in gui for Mysql/MariaDB

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Julien Nabet 2020-05-10 10:40:19 UTC
Backport for 6.4 waiting for review here:
https://gerrit.libreoffice.org/c/core/+/93794
Comment 7 Commit Notification 2020-05-11 07:32:14 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/ae513765f65c9497533f516e5cde2898c0911a1f

tdf#132814: fix put autovalue to Yes in gui for Mysql/MariaDB

It will be available in 6.4.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.