Bug report #20418
PostGIS Split Fails With Data Loss
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Editing | ||
Affected QGIS version: | 3.4.1 | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | Yes | Copied to github as #: | 28238 |
Description
To reproduce:
--------------------------create table test (
id serial primary key,
geom geometry(linestring,4326)
);
insert into test (geom)
select st_setsrid(st_makeline(st_makepoint(1,2),st_makepoint(3,4)),4326)
;
--------------------------
- Add layer "test" to map
- Start editing session
- Split line into three features with a single split operation
- Save edits
- After error is given, quit editing session by discarding changes
What should happen:
Layer saves the three features.
What happens:
Error is given indicating a failure to save edits because of a duplicate key violation. One of the three features is saved,
the other two are deleted from the dataset, despite having discarded all edits when prompted.
History
#1 Updated by Giovanni Manghi about 6 years ago
- Operating System deleted (
Windows)
#2 Updated by Bernhard Ströbl about 6 years ago
I can reproduce the behaviour (with one of my PosGIS layers)
While splitting I get the following warnings in the PostGIS-Tab of the logWARNING Query: DECLARE qgis_24 BINARY CURSOR FOR SELECT "gid","href1"::text,"href2"::text,"level_name"::text,"gidb"::text,"datum"::text,"nocheinint"::text FROM "myschema"."mytable" WHERE ("gid" = 'nextval(''myschema.mytable_gid_seq''::regclass)') LIMIT 1 returned 7 [ERROR: invalid input syntax for integer: "nextval('myschema.mytable_gid_seq'::regclass)"
WARNING 1 cursor states lost.
SQL: DECLARE qgis_6 BINARY CURSOR FOR SELECT "gid","href1"::text,"href2"::text,"level_name"::text,"gidb"::text,"datum"::text,"nocheinint"::text FROM "myshema"."mytable" WHERE ("gid" = 'nextval(''myschema.mytable_gid_seq''::regclass)') LIMIT 2
Result: 7 (ERROR: invalid input syntax for integer: "nextval('myschema.mytable_gid_seq'::regclass)"
gid is an integer field
#3 Updated by Bernhard Ströbl about 6 years ago
I can save the split features when ticking Evaluate default values on provider side in Project Properties - Data Sources
@Spencer: could you check if that works for you?
Nevertheless the issue is still valid as the data is corrupted although Discard changes is chosen.
#4 Updated by Jan Lippmann about 6 years ago
I can confirm. In my case with polygons.
I think this problem has a relationship with #20431 , because:
1. Step: If i split one feature in only two parts..if i don't save edits..there is no issue
2. Step: If i split another one feature in only two parts...there is a problem with duplicate key violation
BTW: If i save edits after step 1., there is no problem with duplicate key violation
#5 Updated by Stephen Knox almost 6 years ago
I can't reproduce this on 3.5 master - I get three seperate lines after splitting, with no errors
#6 Updated by Giovanni Manghi almost 6 years ago
- Status changed from Open to Feedback
Stephen Knox wrote:
I can't reproduce this on 3.5 master - I get three seperate lines after splitting, with no errors
The original reporter also confirms?
#7 Updated by Spencer Gardner almost 6 years ago
I'm on vacation for a few more days so I won't be able to confirm until then. I strongly suspect Jan is correct about this being related to #20431 which has been resolved.
#8 Updated by Jan Lippmann almost 6 years ago
My Test with 3.4.3: There is no more issue. I think 32b7d7e5ddeef7a66592267819e234085c44a7bc solved the problem. Ticket can be closed...
#9 Updated by Nyall Dawson almost 6 years ago
- Resolution set to fixed/implemented
- Status changed from Feedback to Closed