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

Cannot paste unsaved changes as temporary scratch layer #38913

Open
uclaros opened this issue Sep 21, 2020 · 4 comments · May be fixed by #57985
Open

Cannot paste unsaved changes as temporary scratch layer #38913

uclaros opened this issue Sep 21, 2020 · 4 comments · May be fixed by #57985
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)

Comments

@uclaros
Copy link
Contributor

uclaros commented Sep 21, 2020

Describe the bug
If I copy to clipboard features that are not yet saved to the underlying provider hence they have "Autogenerate" as their fid, then I cannot paste them as a new temporary scratch layer.
The log shows : ../src/core/qgsvectordataprovider.cpp:739 : (pushError) [0ms] Could not store attribute "GPKG_FID": Value "Autogenerate" is not a number

How to Reproduce

  1. Add a geopackage layer and start editing
  2. Add a feature by digitizing, its FID becomes "Autogenerate"
  3. Select the feature and copy to clipboard
  4. Paste as temporary scratch layer / ctrl+alt+v

QGIS and OS versions
02f5c13 on Debian

@uclaros uclaros added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 21, 2020
@uclaros uclaros changed the title Cannot paste as temporary scratch layer unsaved changes Cannot paste unsaved changes as temporary scratch layer Sep 21, 2020
@roya0045
Copy link
Contributor

So you're saying that the fid validation kicks in when pasting instead of letting it pass, updating the fids and then check?

@uclaros
Copy link
Contributor Author

uclaros commented Oct 17, 2020

The resulting field fid is created as Integer64 NOT NULL UNIQUE and then features with literally the value Autogenerate are tried to be inserted. If I manually change the fid values then it obviously works just the same as if it was saved first.

@gioman gioman added the Vectors Related to general vector layer handling (not specific data formats) label Jan 2, 2021
@tudorbarascu
Copy link
Member

tudorbarascu commented Mar 3, 2021

Also encountered this today. QGIS 3.16.4.

  • Added some features to a table without saving (in a postgresql table with a sequence primary key on the id column). In the column id I have nextval('.. for the new features as I didn't get to save
  • Selecting those new features (nextval.. in the id) in the attribute table and trying to either paste them as a temporary stratch layer or saving them as geopackage doesn't work until I give the id a value (I did it using @row_number + 500000)

@Pedro-Murteira
Copy link

Still true on QGIS 3.22.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants