Triggers and INHERITS - Mailing list pgsql-general

From Joachim Zobel
Subject Triggers and INHERITS
Date
Msg-id 1101713804.3630.12.camel@localhost
Whole thread Raw
List 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


pgsql-general by date:

Previous
From: Scott Cain
Date:
Subject: Re: ERROR: could not access status of transaction 210
Next
From: "金更达"
Date:
Subject: support