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

PostGIS Split Fails With Data Loss #28238

Closed
qgib opened this issue Nov 8, 2018 · 9 comments
Closed

PostGIS Split Fails With Data Loss #28238

qgib opened this issue Nov 8, 2018 · 9 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Editing High Priority Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented Nov 8, 2018

Author Name: Spencer Gardner (@spencerrecneps)
Original Redmine Issue: 20418
Affected QGIS version: 3.4.1
Redmine category:editing


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)@
@;@

  1. Add layer "test" to map
  2. Start editing session
  3. Split line into three features with a single split operation
  4. Save edits
  5. 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.

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2018

Author Name: Giovanni Manghi (@gioman)


  • operating_system was changed from Windows to

@qgib
Copy link
Contributor Author

qgib commented Nov 15, 2018

Author Name: Bernhard Ströbl (Bernhard Ströbl)


I can reproduce the behaviour (with one of my PosGIS layers)

While splitting I get the following warnings in the PostGIS-Tab of the log
@warning 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

@qgib
Copy link
Contributor Author

qgib commented Nov 15, 2018

Author Name: Bernhard Ströbl (Bernhard Ströbl)


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.

@qgib
Copy link
Contributor Author

qgib commented Nov 15, 2018

Author Name: Jan Lippmann (@j-lippmann)


I can confirm. In my case with polygons.

I think this problem has a relationship with #28251 , 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

@qgib
Copy link
Contributor Author

qgib commented Jan 4, 2019

Author Name: Stephen Knox (Stephen Knox)


I can't reproduce this on 3.5 master - I get three seperate lines after splitting, with no errors

@qgib
Copy link
Contributor Author

qgib commented Jan 4, 2019

Author Name: Giovanni Manghi (@gioman)


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?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Jan 4, 2019

Author Name: Spencer Gardner (@spencerrecneps)


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 #28251 which has been resolved.

@qgib
Copy link
Contributor Author

qgib commented Jan 5, 2019

Author Name: Jan Lippmann (@j-lippmann)


My Test with 3.4.3: There is no more issue. I think 32b7d7e solved the problem. Ticket can be closed...

@qgib
Copy link
Contributor Author

qgib commented Jan 5, 2019

Author Name: Nyall Dawson (@nyalldawson)


  • resolution was changed from to fixed/implemented
  • status_id was changed from Feedback to Closed

@qgib qgib closed this as completed Jan 5, 2019
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority Editing Crash/Data Corruption Regression Something which used to work, but doesn't anymore labels May 25, 2019
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! Crash/Data Corruption Editing High Priority Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant