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

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

Closed
asgharibraheembaloch opened this issue Jan 15, 2020 · 3 comments · Fixed by #39354
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@asgharibraheembaloch
Copy link

asgharibraheembaloch commented Jan 15, 2020

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"

@asgharibraheembaloch asgharibraheembaloch added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 15, 2020
@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Jan 16, 2020
@gioman gioman changed the title Edit Feature in Place with Postgis Layer "duplicate key value violates unique constraint" error when using "Edit Feature in Place" with PostGIS Layer Jan 16, 2020
@elpaso elpaso added the Feedback Waiting on the submitter for answers label Jan 22, 2020
@elpaso
Copy link
Contributor

elpaso commented Jan 22, 2020

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

@asgharibraheembaloch
Copy link
Author

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

@dtk78
Copy link

dtk78 commented May 5, 2020

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.

@nyalldawson nyalldawson self-assigned this Oct 13, 2020
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Oct 15, 2020
algorithms with the RegeneratePrimaryKey flag in in-place mode

Fixes qgis#37761, fixes qgis#33816
nyalldawson added a commit that referenced this issue Oct 15, 2020
algorithms with the RegeneratePrimaryKey flag in in-place mode

Fixes #37761, fixes #33816
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! Feedback Waiting on the submitter for answers Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants