Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In gpkg, query builder prevents autogenerate of pasted feature with same fid as hidden feature #30062

Closed
SteveLowman opened this issue Jun 3, 2019 · 2 comments · Fixed by #30096

Comments

@SteveLowman
Copy link

commented Jun 3, 2019

The first six steps show the bug problem, which is that the non-unique fid value of pasted feature with the same fid value as an already existing feature that is hidden by query builder will not be detected, and so the edit cannot be saved.

  1. Apply this query builder expression to Destination_Layer: "fid" IN (109, 110)

  2. Open Source_Layer attribute table, select and copy feature with fid 111, 112, or 113 (one of the fid values hidden in the destination layer).

  3. With Destination_Layer in edit mode, paste the copied feature (paste successful).

  4. Observe that the pasted fid value remains unchanged.

  5. Attempt to save the edit.

  6. Observe the error:
    Could not commit changes to layer Destination_Layer

    Errors: ERROR: 1 feature(s) not added.

    Provider errors:
    OGR error creating feature -2: failed to execute insert : UNIQUE constraint failed: query_builder_copy_paste_bug_test_layer2.fid

  7. Undo the edit.

The following steps show that a pasted feature with fid the same as feature visible in the destination layer gets a new autogenerated fid value with no problem.

  1. In Source_Layer, select and copy feature 109 or 110 (values not hidden in the destination layer).
  2. Paste the copied feature into Destination_Layer.
  3. Observe that the pasted fid value is set to 'Autogenerate'.
  4. Save the edit.
  5. Clear the query, and observe that the pasted feature has saved with no problem, autogenerating a new fid value.

This is tested in 3.4.7 LTR, and a recent nightly build of 3.6/3.7, using Windows 10.
Possible related issues include #26960, #28277
QueryBuilder_CopyPasteBug_test.zip

@SteveLowman SteveLowman added the Bug label Jun 3, 2019

@elpaso elpaso self-assigned this Jun 5, 2019

elpaso added a commit to elpaso/QGIS that referenced this issue Jun 5, 2019
@SteveLowman

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

Thanks for doing this. Will it be okay to backport to the LTR?

@elpaso

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

Yes

@elpaso elpaso closed this in #30096 Jun 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.