[postgis-users] User defined functions

Mike Toews mwtoews at sfu.ca
Sun Sep 6 14:59:51 PDT 2009


You need to make a common trigger procedure in (for example) PL/pgSQL 
that does the update on column X (i.e., NEW.X). See:
http://www.postgresql.org/docs/current/interactive/plpgsql-trigger.html

Then you can turn this common trigger procedure onto 1 or more tables 
that have a column "X" that require similar desired actions from the 
procedure. See:
http://www.postgresql.org/docs/current/interactive/triggers.html

If you use pgAdmin III, it has a great GUI for setting these up.

-Mike

Bob Pawley wrote:
> Hi
>  
> I am attempting to understand user defined functions.
>  
> I am in need of a common function that will update a  column in table 
> X when a trigger on table Y or table Z is triggered.
>  
> Is the user defined function the way to go?... or would it be better 
> to use a fourth table to trigger a common function?
>  
> Bob




More information about the postgis-users mailing list