AnsweredAssumed Answered

Postgres versioned triggers

Question asked by DomPou on Dec 19, 2017

Hi guys, we encountered as strange problem with triggers in our arcsde postgres db (with Arc 10.5, Postgres 9.5) and can't figure out what to do. Basically, we can create manually a table containing all the data from a versioned table with no problem using: 

 

CREATE TABLE sde.copy_of_view AS SELECT * FROM sde.view;

 

But if we use a trigger function like :

 

CREATE OR REPLACE FUNCTION sde.function_copy_view()

RETURNS trigger AS $$

BEGIN

   CREATE TABLE sde.copy_of_view AS SELECT * FROM sde.view;

   return NEW;

END; $$ LANGUAGE plpgsql;

 

 And this trigger:   

 

CREATE TRIGGER change_to_view AFTER INSERT OR UPDATE OR DELETE ON sde.view

EXECUTE PROCEDURE sde.copy_of_view();

 

The resulting table is missing the last change made in ArcMap. Any idea what we are doing wrong?  Thanks guys.

Outcomes