Bug 153004 - Copying content to a table without an auto value primary key gives an error but copies the whole content
Summary: Copying content to a table without an auto value primary key gives an error b...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: All All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:7.6.0 target:7.5.4
Keywords: bibisectRequest, regression
Depends on:
Blocks:
 
Reported: 2023-01-13 08:34 UTC by Robert Großkopf
Modified: 2023-05-09 08:01 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 Robert Großkopf 2023-01-13 08:34:23 UTC
Take this database file: https://bugs.documentfoundation.org/attachment.cgi?id=184626
Copy the query and paste it as new table. See description https://bugs.documentfoundation.org/show_bug.cgi?id=153003

If you try this with LO 7.2.0.4 (and up to LO 7.4.3.2) you will get an error:

This operation is not supported in statement [ALTER TABLE "tbl_Auto1" ALTER "ID" RESTART WITH 3] /home/buildslave/source/libo-core/connectivity/source/drivers/jdbc/Object.cxx:175

This error appears when inserting content into a table, which has been created with a primary key without Auto Value. Wizard tries to set the start for an auto value to the new value, but it couldn't, because a normal INTEGER doesn't support this.

You won't get this error with LO 7.4.4.2, because the import fails before this message would appear. See bug 153003.

Bug appears in OpenSUSE 15.3 64bit rpm Linux.
Comment 1 Julien Nabet 2023-01-15 09:49:40 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I gave a try with https://gerrit.libreoffice.org/c/core/+/145525

Indeed, hsqldb doesn't need all this part of code, I tested the patch with autovalue to yes and with autovalue to no, it worked in both cases.
Comment 2 Commit Notification 2023-01-15 10:36:51 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9d2355b674d103fe8a73d2db716389980bb69e55

tdf#153004: error when copying content to a table without autovalue primary key

It will be available in 7.6.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 3 Julien Nabet 2023-01-15 10:39:28 UTC
Robert: before cherry-picking the patch to 7.5 and 7.4 branch, could you confirm it's ok for you and that the patch won't bring a brand new regression?
Comment 4 Julien Nabet 2023-05-08 11:24:00 UTC
Robert: is daily master 7.6 LO ok now?
Comment 5 Robert Großkopf 2023-05-08 14:00:18 UTC
(In reply to Julien Nabet from comment #4)
> Robert: is daily master 7.6 LO ok now?

Right, Julian. Works now with daily build of LO 7.6.0.0alpha0
Comment 6 Julien Nabet 2023-05-08 14:37:24 UTC
Thank you for the feedback, let's put this one to FIXED then.

Here's the cherry-pick for 7.5 waiting for review:
https://gerrit.libreoffice.org/c/core/+/151514
Comment 7 Commit Notification 2023-05-09 08:01:10 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/656fe420f0cb7d1c4f69f6aa5777c47eac90189f

tdf#153004: error when copying content to a table without autovalue primary key

It will be available in 7.5.4.

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.