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 


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to