When I enter new elements (features) in another Postgres layer, I can do it in two ways:
- Drawing new element(s) (with 'Add feature') which I do rarely or
- Copying (or cutting) some elements from another Postgre layer (Source layer), and paste it into target layer which I do frequently
In first example, saving of edits works normal because this layer gets gid from postgre database sequence *nextval('layer_name_gid_seq'::regclass)*
In second example, I got an error during saving edits, because while copying element from source layer to target layer qgis copied gid of element from source layer. When attempting to save edits this error is returned:
Could not commit changes to layer „Cjevovodi“
Errors: ERROR: 1 feature(s) not added.
Provider errors:
PostGIS error while adding features: ERROR: duplicate key value violates unique constraint "cjevovodi_okill_pkey"
DETAIL: Key (gid)=(5) already exists.
I tried to copy *nextval('layer_name_gid_seq'::regclass)* in field gid, but this sequence can`t be pasted in field gid as field is defined as numeric.
Does anyone know simple way to copy elements from source layer (with existing gid) assign new gid?
Thanks!
