Hi,
I have a Postgis table which is published as a Geoserver layer. I want to make 
a certain criteria on updating a specific column of that table. So I have 
created the following trigger:

CREATE TRIGGER my_column_trigger
  BEFORE UPDATE OF my_column
  ON geometry_table
  FOR EACH ROW
  EXECUTE PROCEDURE check_can_update();

And I have created the following trigger procedure:

CREATE OR REPLACE FUNCTION check_can_update()
  RETURNS trigger AS
$BODY$
BEGIN
IF criteria_is_satisfied() THEN
RETURN NEW;
ELSE
RAISE EXCEPTION 'You can not update my_column';
END IF;
END;
$BODY$
LANGUAGE 'plpgsql';

Now, in PGAdmin4 if I tried to update my_column while the criteria is NOT 
satisfied, then an error is returned telling 'You can not update my_column'.

So far so good. The problem is when I try to do the same from Geoserver with 
WFS, while the criteria is NOT satisfied, it does not return any error, instead 
it returns a normal return, something like:
<wfs:TransactionSummary>
        <wfs:totalInserted>
            0
        </wfs:totalInserted>
        <wfs:totalUpdated>
            3
        </wfs:totalUpdated>
        <wfs:totalDeleted>
            0
        </wfs:totalDeleted>
</wfs:TransactionSummary>

But the data of the DB table is not updated !!
In other words WFS tells that everything is ok, but actually nothing is updated.

I think it's a bug with Geoserver, it returns the number of records that should 
be affected instead of the number of really updated records.

Can anybody help me with why this happens and how to solve this problem?

If any one wants to replicate this error, he can create a trigger like the 
above one with just one line "RAISE EXCEPTION 'error'".

Regards,
Nanaso
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to