Re: before insert for each row trigger on upsert

Поиск
Список
Период
Сортировка
От Ted Toth
Тема Re: before insert for each row trigger on upsert
Дата
Msg-id CAFPpqQHvynSRr4HX_a5tkqOBDat4zEk0a_fS+WPiJBLk8Uc_3A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: before insert for each row trigger on upsert  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: before insert for each row trigger on upsert
Re: before insert for each row trigger on upsert
Список pgsql-general


On Thu, Feb 20, 2020 at 2:32 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 2/20/20 12:17 PM, Ted Toth wrote:
> I'm a little confused why the before insert trigger fires al all but
> since it does is  there a way to know that an update will occur?

Because ON CONFLICT DO UPDATE is part of an INSERT command.

> Basically I don't want the trigger affect the row on update.

Not sure that a BEFORE trigger will work for that anyway as it will not
have submitted the data yet for ON CONFLICT resolution.

I think you are right in that the trigger doesn't change the row being updated (which is good) but it also updates another table and that's what I'd actually like to avoid on update.


>
> Ted


--
Adrian Klaver
adrian.klaver@aklaver.com

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

Предыдущее
От: Justin
Дата:
Сообщение: Re: How to fix 0xC0000005 exception in Postgres 9.0
Следующее
От: "Andrus"
Дата:
Сообщение: Re: How to fix 0xC0000005 exception in Postgres 9.0