2

WFS service in Mapserver directly changes the PostgreSQL table whenever performing a transaction operation such as insert, update or delete.

I want a solution which gives me control over what happens when a transaction request is received from the client.

For example, when a new value is inserted, instead of making changes in original table I want to create another table in SQL which would be a clone of previous one and make changes in that table. So, that the original table remains the same.

6
  • 1
    Do you mean the ESRI Mapserver? And why did you set the "geoserver" tag? Anyway, yes it is possible to write special code that captures the transaction messages and manipulates them like you wish. I am pretty sure that no standard WFS server has such capabilities included. Commented Feb 17, 2023 at 11:18
  • Do you want to hide the edits from other users? Otherwise I think it would be easier to let users update the master table and keep a backup table with static data. Commented Feb 17, 2023 at 12:43
  • Either Mapserver or geoserver both would do. I just want control over transactions. Each user will have his own table cloned from the original version and original one will remain same for everyone. Commented Feb 17, 2023 at 16:16
  • This MapServer mapserver.org does not do transactions at all. You will get better answers by making clear questions. Commented Feb 17, 2023 at 16:42
  • MapServer.org has wfs-t I think it is called tinyows but it doesn't give custom transaction control Commented Feb 17, 2023 at 16:46

2 Answers 2

4

Looks like a job for a database trigger. Since you mention PostgreSQL, here is some documentation about the topic: https://www.postgresql.org/docs/current/sql-createtrigger.html

5
  • I was hoping for something which is more programmable(customizable) instead of triggers. One solution is to write wfs myself using ogc wfs specification but that will take a lot of time Commented Feb 17, 2023 at 16:18
  • Certainly yes. Forking some of the open source servers would save some time. Commented Feb 17, 2023 at 16:44
  • can't find any. Are aware of any such solution Commented Feb 17, 2023 at 16:45
  • GeoServer and deegree are maintained Open Source WFS servers. TinyOWS not so well maintained but should work still. When I was involved in a bit similar tweaked WFS-T we captured the transaction messages when they came to web server and split and manipulated them to do custom things. We did not touch the WFS server code. Commented Feb 17, 2023 at 17:09
  • @user30184 did you use geoserver or deegree when you you were tweaking wfs-t. Any tutorial or guide that I could follow? Commented Feb 18, 2023 at 10:25
1

Usually you'd handle this with updateable Views as middlelayer; I outlined the general concept in this answer, using INSTEAD OF triggers, and you'll find more info on DBA.SE.

In your case you'd likely want to use support tables much like ESRI's delta table versioning, where any data modification is logged as a sequence of INSERT (A table) and DELETE (D table) operations, including their respectively modified values, and have the View pull live data from a composition of the base table and the A & D tables.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.