Triggers and INHERITS

Поиск
Список
Период
Сортировка
От Joachim Zobel
Тема Triggers and INHERITS
Дата
Msg-id 1101713804.3630.12.camel@localhost
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Scott Cain
Дата:
Сообщение: Re: ERROR: could not access status of transaction 210
Следующее
От: "金更达"
Дата:
Сообщение: support