Skip site navigation (1) Skip section navigation (2)

Inherits and triggers

From: "Fangbing Wu" <fangbingw(at)gmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Inherits and triggers
Date: 2006-03-14 01:25:46
Message-ID: 6619c3340603131725w3a5b72a8y1324f9274ec2ab45@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
I have a situation where I want all of my tables to have a timestamp field
that is updated to the
current_timestamp whenever a column in a row is updated. For a single table,
I could do this
with a trigger. So I thought of using table inheritance and created the
trigger on the base
table. But then, the trigger is not fired when updating rows in children
tables.

Does anyone knows of a better way to achieve this without having to create
the trigger
for every table? I'm writing a library and the tables are not known at the
time of writing
the library.

Any suggestions are appreciated!

Fangbing Wu

pgsql-interfaces by date

Next:From: Christopher Kings-LynneDate: 2006-03-14 02:53:19
Subject: Re: [PATCHES] Proposed patch for error locations
Previous:From: Tom LaneDate: 2006-03-13 21:28:38
Subject: Re: [PATCHES] Proposed p.tch for error locations

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group