Triggers and INHERITS

From: Joachim Zobel <jzobel(at)heute-morgen(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Triggers and INHERITS
Date: 2004-11-29 18:10:35
Message-ID: 1101713804.3630.12.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

I want to use a table

CREATE TABLE stats (
upd TIMESTAMP,
crt TIMESTAMP DEFAULT NOW()
);

with inheritance

CREATE sometable (
)
INHERITS stats

to automatically maintain update dates. However the obviuos trigger

CREATE OR REPLACE
FUNCTION stat_upd()
RETURNS TRIGGER
AS '
BEGIN
new.upd = ''now'';
RETURN new;
END;
' LANGUAGE plpgsql;

CREATE TRIGGER stat_upd
BEFORE UPDATE
ON stats
FOR EACH ROW
EXECUTE PROCEDURE stat_upd();

does not work. Is there a way around this?

Doing a CREATE TRIGGER for all child tables is not a good option since I
am checking if it is possible to build a generic database (a shop with
catalog and cart) that can be customized through inheritance.

Sincerely,
Joachim

--
"... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden
koennen." - Bertolt Brecht - Leben des Galilei

Browse pgsql-general by date

  From Date Subject
Next Message Mark Dexter 2004-11-29 19:48:37 VACUUM and ANALYZE Follow-Up
Previous Message Scott Cain 2004-11-29 18:01:54 Re: ERROR: could not access status of transaction 210