Bug 150089 - MariaDB: Pasting table from internal HSQLDB to MariaDB finishes with wrong command "RESTART WITH".
Summary: MariaDB: Pasting table from internal HSQLDB to MariaDB finishes with wrong co...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:7.5.0 target:7.4.0.2
Keywords: bibisected, regression
Depends on:
Blocks:
 
Reported: 2022-07-21 13:56 UTC by Robert Großkopf
Modified: 2022-07-27 15:49 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2022-07-21 13:56:19 UTC
Open a connection to MariaDB, Could be it is the same with MySQL. Error appears here with MariaDB and direct connection, also JDBC connection.

Copy a table of an existing HSQLDB database, which contains a primary key as auto value.
Switch to MariaDB.
Paste this table to MariaDB. Could be you have to add the name of the database (database.table).
Table will be created and pasting ends with an error: "… see near RESTART WITH …".

RESTART WITH is an command, which works with both internal databases, but won't work with MariaDB: There it is special used with ALTER SEQUENCE. For auto-Increment see:
https://mariadb.com/kb/en/auto_increment/
ALTER TABLE tablename AUTO_INCREMENT=8;
will set the next value in MariaDB.

But: This is needless. The data will be inserted right and the next value will be automatically the next free value.

Tested this with LO 7.4.0.1 on OpenSUSE 15.3 64bit rpm Linux.
This bug won't appear with LO 7.1.5.2 on the same machine.
This bug appears also with LO 7.3.5.2, 7.2.5.1, 7.2.0.4 on the same machine.
Comment 1 Julien Nabet 2022-07-24 21:28:25 UTC
Regression from https://cgit.freedesktop.org/libreoffice/core/commit/?id=2a8e120db1c3175ff937cdbe6d0ade23dc380c01
commit 2a8e120db1c3175ff937cdbe6d0ade23dc380c01 (patch)
tree 58c9d21d1f330791c614b96b0cd04aad6296cd27
parent b7d8ee083230964de2e1580c4639ee4cd307207f (diff)
tdf#119962 Fix autoincrement for copied table
in 2021.

Oleksii/Noel: thought you might be interested in this one.

Perhaps using getDatabaseProductName method to test destination DB type to know if we need to call all the code added in the patch ?
Comment 2 Julien Nabet 2022-07-25 07:48:21 UTC
No need to bibisect here.
Comment 3 Julien Nabet 2022-07-27 11:38:40 UTC
I gave a try with https://gerrit.libreoffice.org/c/core/+/137499
Comment 4 Commit Notification 2022-07-27 12:43:11 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4d855bb916bd41221e2b23d6d782e19b4b2740f9

tdf#150089: not all databases know "RESTART WITH"

It will be available in 7.5.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 5 Julien Nabet 2022-07-27 12:47:59 UTC
Patch for 7.4 waiting for review here:
https://gerrit.libreoffice.org/c/core/+/137515
Comment 6 Commit Notification 2022-07-27 15:49:45 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/8c54c132cac96bb13ff70d3920c81d126fd7c17d

tdf#150089: not all databases know "RESTART WITH"

It will be available in 7.4.0.2.

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.