X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0FC1A9DCDBC for ; Mon, 13 Mar 2006 21:25:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07295-03 for ; Mon, 13 Mar 2006 21:25:48 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) by postgresql.org (Postfix) with ESMTP id B99F79DCDC5 for ; Mon, 13 Mar 2006 21:25:42 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 9so1382070nzo for ; Mon, 13 Mar 2006 17:25:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=iF8kzZZGmD8GexO0oJR+lqKoW7xb4rZ10+qK1ZeN27Jv6Z2lB2k1AUVuQpVH/jOSOnxCTYofQMF2B7IA8Os1gpoMlp62eWlTKluWhEjV+pO1FQF+yJr03rscGlrZphi7r5MSIGlidIrUawyEtUAhLAue+8Wt9E7Uy5EM2K8Z2+Q= Received: by 10.37.22.23 with SMTP id z23mr345983nzi; Mon, 13 Mar 2006 17:25:46 -0800 (PST) Received: by 10.36.121.1 with HTTP; Mon, 13 Mar 2006 17:25:46 -0800 (PST) Message-ID: <6619c3340603131725w3a5b72a8y1324f9274ec2ab45@mail.gmail.com> Date: Mon, 13 Mar 2006 20:25:46 -0500 From: "Fangbing Wu" To: pgsql-interfaces@postgresql.org Subject: Inherits and triggers MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10581_11018987.1142299546384" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.643 required=5 tests=[HTML_00_10=0.642, HTML_MESSAGE=0.001] X-Spam-Score: 0.643 X-Spam-Level: X-Archive-Number: 200603/17 X-Sequence-Number: 6073 ------=_Part_10581_11018987.1142299546384 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 ------=_Part_10581_11018987.1142299546384 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I have a situation where I want all of my tables to have a timestamp fi= eld 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 tho= ught of using table inheritance and created the trigger on the base
table. But then, the trigger is not fired when updating rows in childre= n 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=

------=_Part_10581_11018987.1142299546384--