Download it now!
Bug 114955 - Copy table with "Create new field as primary key" should demote the existing primary key to simple field
Summary: Copy table with "Create new field as primary key" should demote the existing ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.4.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:6.1.0 target:6.0.0.2
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-10 20:03 UTC by Julien Nabet
Modified: 2018-01-11 12:29 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 Julien Nabet 2018-01-10 20:03:47 UTC
Description:
In Base part, in dialog process for duplicate a table, checking "Create new field as primary key" should indeed create a new field with Name indicated (by default "ID") but the existing primary key fields should be demoted to simple fields.

Steps to Reproduce:
1. Enable experiment features (Tools/Options/Advanced)
2. Retrieve file https://bugs.documentfoundation.org/attachment.cgi?id=138647
3. Open file and go to "Tables panel"
4. Right click on the only table and select "Copy"
5. Right click on background of table panel and select "Paste..."
=> Copy table dialog opens
6. Let "Definition and data" and click on "Create new field as primary key"
7. Click Next
8. Click double arrow towards right to put both fields from left to right panel
9. Click Next

Actual Results:  
There are 2 fields for primary key:
- ID (as expected)
- cardinal (not expected)

Expected Results:
Only field ID should be primary key


Reproducible: Always


User Profile Reset: No



Additional Info:
Reproduced with master sources updated yesterday


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Julien Nabet 2018-01-10 20:09:12 UTC
Lionel: here the bugtracker following your comment in https://gerrit.libreoffice.org/#/c/47684/
Comment 2 Julien Nabet 2018-01-10 22:27:25 UTC
I submitted a patch to review here:
https://gerrit.libreoffice.org/#/c/47732/
Comment 3 Commit Notification 2018-01-11 10:06:53 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2711f7639811929fc9ea8dc168ea28f1c5545e67

tdf#114955: Fix primary key management in copy table

It will be available in 6.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Julien Nabet 2018-01-11 10:14:38 UTC
For 6.0 branch, patch on review here:
https://gerrit.libreoffice.org/#/c/47745/

I don't think it worths it to cherry-pick on 5.4 branch, so let's put this one to FIXED.
Comment 5 Commit Notification 2018-01-11 12:29:52 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2481e7dd49b8c8fe0dc97ff86a2a35267c2c06d3&h=libreoffice-6-0

tdf#114955: Fix primary key management in copy table

It will be available in 6.0.0.2.

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

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