[Cialug] Postgres trigger help.
Tim Wilson
tim_linux at wilson-home.com
Mon Aug 13 23:01:12 CDT 2007
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/cialug/attachments/20070813/141ea04e/attachment.htm
More information about the Cialug
mailing list