Re: trigger on delete/field update

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Ruslan R(dot) Laishev" <zator(at)yandex(dot)ru>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: trigger on delete/field update
Date: 2017-10-16 14:37:52
Message-ID: CAKFQuwZwkYGWQ5paACtgJKMrK+t7y4kCvD_c6VzcJj7QDMZGaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Oct 16, 2017 at 7:27 AM, Ruslan R. Laishev <zator(at)yandex(dot)ru> wrote:

> So, what I'm need to check ?
>

​I assume you are using a BEFORE trigger on the table...​

​The docs imply what you want to do is not possible using triggers.

https://www.postgresql.org/docs/10/static/plpgsql-trigger.html#plpgsql-dml-trigger

"​Row-level triggers fired BEFORE can return null to signal the trigger
manager to skip the rest of the operation for this row (i.e., subsequent
triggers are not fired, and the INSERT/UPDATE/DELETE does not occur for
this row)."

It might be possible to accomplish your goal with an INSTEAD OF trigger on
a View over the table...I have never tried this.

https://www.postgresql.org/docs/10/static/sql-createtrigger.html

David J.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Moreno Andreo 2017-10-16 14:42:08 Re: The server does not listen
Previous Message Adarsh Jaiswal 2017-10-16 14:31:20 Re: The server does not listen