[Cialug] Postgres trigger help.

Josh More morej at alliancetechnologies.net
Mon Aug 13 23:10:38 CDT 2007


Are you defining your functions before you call them as triggers?  I
remember having that issue when I did this years ago.



-Josh More, RHCE, CISSP, NCLP, GIAC 
 morej at alliancetechnologies.net 
 515-245-7701

>>> "Tim Wilson" <tim_linux at wilson-home.com> 08/13/07 11:01 PM >>>
That's one of the examples I was talking about.  The function that is
created in the example returns type "trigger" (quotes added for
emphasis).
When I try that in my version, it says 'parse error at or near
"trigger"'.
Another example said to use void, another said opaque.  All caused the
parser to complain.

On 8/13/07, Kevin C. Smith <kevin at linuxsmith.com> wrote:
>
> On Mon, 2007-08-13 at 22:02 -0500, Tim Wilson wrote:
> > I'm using Postgres 7.1.3, and I'm trying to set up a trigger.  I
have
> > a last_updated column on all of my tables, that is of type
timestamp.
> > I want to set the field every time the record is updated.  I thought
a
> > trigger would be best for that, but every example I find via Google
> > doesn't work.  One said to create a function that returned type
> > TRIGGER, another said type VOID, neither of which worked.  Every
> > example I find uses one of those return types.  Anyone have any
> > ideas?
>
> I haven't tried triggers with postgresql, but I think it's a two
> step thing in most cases. Write a function, then create a trigger
> to call that function on insert or update.
>
> Try:
> http://www.postgresql.org/docs/8.2/static/triggers.html
> http://www.postgresql.org/docs/8.2/static/plpgsql.html
>
> Religion is regarded by the common people as true, by the wise as
false,
> and by the rulers as useful. --- Lucius Annaeus Seneca
>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>



-- 
Tim



More information about the Cialug mailing list