[Cialug] Postgres trigger help.
Kevin C. Smith
kevin at linuxsmith.com
Mon Aug 13 22:22:57 CDT 2007
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
More information about the Cialug
mailing list