qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.39k stars 2.98k forks source link

Cannot paste unsaved changes as temporary scratch layer #38913

Open uclaros opened 4 years ago

uclaros commented 4 years ago

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 02f5c13ea0 on Debian

roya0045 commented 3 years ago

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

uclaros commented 3 years ago

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.

tudorbarascu commented 3 years ago

Also encountered this today. QGIS 3.16.4.

Pedro-Murteira commented 2 years ago

Still true on QGIS 3.22.3.