Basic Trigger Question

Поиск
Список
Период
Сортировка
От Aragorn
Тема Basic Trigger Question
Дата
Msg-id J4Sy9.706476$Ag2.26563753@news2.calgary.shaw.ca
обсуждение исходный текст
Ответы Re: Basic Trigger Question  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
I've used triggers before in another DB  where the total functionality
was included in the CREATE TRIGGER statement, totally written in SQL. I
understand that postgresql can't do that (correct?).

I want to delete a row in table 2 when I update table 1, with something
along the lines of :
CREATE TRIGGER mytrigger AFTER UPDATE ON table1
    FOR EACH ROW
           DELETE FROM table2
    WHERE table1.id = table2.id

Afterwards I will re-insert any necessary info into table 2.


Can anyone help me with this?

TIA

ps If I need to use a function to do this, pls show me how to do the
same with a function.

--
Ron St.


В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Lamb
Дата:
Сообщение: Re: null value in queries to default in zero
Следующее
От: Scott Lamb
Дата:
Сообщение: Re: psql question