Hi,
I am using geoserver 2.7.0 to edit postgis layers through WFS-T.
For simple postgis tables such as the following, everything works fine:
CREATE TABLE surfaces
(
id SERIAL NOT NULL,
geom geometry,
CONSTRAINT id_pk_surfaces PRIMARY KEY (id ),
CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 2154)
);
Nevertheless, I want to be able to track the changes to the table.
For that purpose, I use the PostgreSQL Audit Trigger (https://wiki.postgresql.org/wiki/Audit_trigger_91plus).
Then I activate the audit on the table using the following command:
SELECT audit.audit_table(‘surfaces’);
What that does is add the following triggers:
CREATE TRIGGER audit_trigger_row
AFTER INSERT OR UPDATE OR DELETE
ON public.surfaces
FOR EACH ROW
EXECUTE PROCEDURE audit.if_modified_func(‘true’);
CREATE TRIGGER audit_trigger_stm
AFTER TRUNCATE
ON public.surfaces
FOR EACH STATEMENT
EXECUTE PROCEDURE audit.if_modified_func(‘true’);
After that, updates and deletes still work fine but I’m having difficulties with the results of the inserts. Indeed, in the wfs:InsertResults, instead of returning the FeatureIds from my table, the transactionresponse contains the ids from the audit.logged_actions table (event_id).
I don’t know exactly how geoserver gets the ids of the inserted features but I’m guessing that the problem lies there. Doesn’t it?
Does the trigger somehow confuse geoserver (or the postgis datastore)?
Am I not allowed to have triggers on postgis tables if they are used for WFS-T?
Should I try to change the trigger so that geoserver does not get confused?
Or is there something to change elsewhere?
Thank you for your help
Best regards,
···
Julien