3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
259 stars 143 forks source link

Split features deletes smaller feature #2285

Open ghost opened 3 years ago

ghost commented 3 years ago

What is the bug?

Like described in #1301 and #1562

Splitting a polygon feature (SQLite) will delete the smaller one of the two new features. It seems, the unique constraint of the pkuid is the problem, however having one is necessary to use editing in the first place.

2021-05-17 09:54:50 xxx.xxx.xxx.xxx warning 2021-05-17 09:54:50 [2] SQLite3::exec(): UNIQUE constraint failed: pachtkataster.pkuid  /var/www/lizmap-test/lib/jelix/plugins/db/sqlite3/sqlite3.dbconnection.php  120

2021-05-17 09:54:50 xxx.xxx.xxx.xxx error   An error has been raised when saving form data edition to db : 
2021-05-17 09:54:50 xxx.xxx.xxx.xxx error   2021-05-17 09:54:50 xxx.xxx.xxx.xxx [403]   unzulässige Anfrage(UNIQUE constraint failed: pachtkataster.pkuid ( INSERT INTO pachtkataster (pkuid, Test, geometry ) VALUES (2, '1', ST_GeomFromText('POLYGON((512317.558634 5711228.136301954,513997.7410375002 5711605.11527366,513479.88427286904 5710684.654739157,512317.558634 5711228.136301954))', 25832) );))    /var/www/lizmap-test/lib/jelix/plugins/db/sqlite3/sqlite3.dbconnection.php  123
    /test/index.php/lizmap/edition/saveNewFeature
array (   'module' => 'lizmap',   'action' => 'edition:saveNewFeature',   'liz_project' => 'test',   'liz_repository' => 'lizmapedit',   'liz_layerId' => 'pachtkataster_4e58c1b6_fef6_4223_9c04_02feba47f815',   'liz_featureId' => '',   'liz_srid' => '25832',   'liz_proj4' => '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',   'liz_geometryColumn' => 'geometry',   'liz_status' => '0',   '_submit' => '',   'geometry' => 'POLYGON((512317.558634 5711228.136301954,513997.7410375002 5711605.11527366,513479.88427286904 5710684.654739157,512317.558634 5711228.136301954))',   '__JFORMS_TOKEN__' => '',   'pkuid' => '2',   'Test' => '1',   'liz_future_action' => 'close', )

    0   sqlite3DbConnection->_doExec()  /var/www/lizmap-test/lib/jelix/db/jDbConnection.class.php : 173
    1   jDbConnection->exec()   /var/www/lizmap-test/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php : 646
    2   qgisVectorLayer->insertFeature()    /var/www/lizmap-test/lizmap/modules/lizmap/classes/qgisForm.class.php : 986
    3   qgisForm->saveToDb()    /var/www/lizmap-test/lizmap/modules/lizmap/controllers/edition.classic.php : 1061
    4   editionCtrl->saveNewFeature()   /var/www/lizmap-test/lib/jelix/core/jCoordinator.class.php : 225
    5   jCoordinator->process() /var/www/lizmap-test/lizmap/www/index.php : 23

Environment

geographit commented 3 years ago

Hi @DominikVisca ,

As work around you can place a trigger before the record is inserted to check if the feature's unique ID value exists. If it does then use the next value in the sequence.

JLHI commented 1 year ago

Hi, anyone had news or tricks to fix it?