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.6k stars 3.01k forks source link

"duplicate key value violates unique constraint" error when using "Edit Feature in Place" with PostGIS Layer #33816

Closed asgharibraheembaloch closed 4 years ago

asgharibraheembaloch commented 4 years ago

in our postgis database for line(road) layer we have defined primary key field and have applied unique not null constraint when i save split line segements manually by editing toolbar it works fine, but when i split lines with "split with lines" tool by turning on edit feature in place it gives me postgis error """ Could not commit changes to layer pk_roads

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

Provider errors: PostGIS error while adding features: ERROR: duplicate key value violates unique constraint "pk_roads" CONTEXT: SQL statement "INSERT INTO pk_roads SELECT(pk_roads '(,,,,,,,,,,,,0102000020110F000002000000A00ABFB828A35F411E7335C4B9484D41C9CA687C3CA35F41405E7DA3BD484D41,103564332,"digi1,",,,,,,,,,,,,,,,,,,,,,,,,)').* RETURNING id;" PL/pgSQL function fn_rd_partition() line 9 at EXECUTE

""" but from my point of view it must have to work fine for "split with lines" tool if same splitting works from "Advance Digitizing Toolbar"

elpaso commented 4 years ago

What is that fn_rd_partition? it's not part of QGIS nor postgis.

asgharibraheembaloch commented 4 years ago

data is partitioned in database and this function ensures whether user has not crossed the partition region

dtk78 commented 4 years ago

Hi,

Are you resolve your issue ? I have tried the Lizmap 3.4.0pre and I get the same issue. It does not split but cut instead of split. May be something is missing.