[Geoserver-users] Wrong FeatureId in wfs:InsertResults when auditing table

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

On Thu, May 14, 2015 at 3:45 PM, Julien Perret <julien.perret@anonymised.com>
wrote:

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).

Known issue: https://osgeo-org.atlassian.net/browse/GEOT-5117

You will find it solved in 2.7.1 (out next week) and 2.6.4 (out next month).
Or you can pick tomorrow's nighlty build (the fix got backported from
master to 2.7.x and 2.6.x today)

Cheers
Andrea

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

That was fast, thank you!

You are awesome.

Cheers

Julien

···

2015-05-14 15:56 GMT+02:00 Andrea Aime <andrea.aime@anonymised.com>:

On Thu, May 14, 2015 at 3:45 PM, Julien Perret <julien.perret@anonymised.com> wrote:

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).

Known issue: https://osgeo-org.atlassian.net/browse/GEOT-5117

You will find it solved in 2.7.1 (out next week) and 2.6.4 (out next month).
Or you can pick tomorrow’s nighlty build (the fix got backported from master to 2.7.x and 2.6.x today)

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Julien Perret
Researcher / Chargé de recherche du Ministère de l’Écologie, du Développement durable et de l’Énergie (MEDDE)
Laboratoire COGIT, IGN
Tel (work): +33 1 43 98 84 09
Fax (work): +33 1 43 98 85 81
Mobile: +33 6 68 74 82 31
Professional Homepage: http://recherche.ign.fr/labos/cogit/cv.php?prenom=Julien&nom=Perret