Re: stable for each row before insert trigger

From: Олег Самойлов <splarv(at)ya(dot)ru>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: stable for each row before insert trigger
Date: 2019-10-18 06:55:14
Message-ID: 96A6DF7B-1E5C-4900-A253-F53FD94FB071@ya.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eh, stupid answer. Of cause, I read the documentation. But what about you? Do you know what is a trigger function? (for each row before insert)

A trigger function don't have parameters, instead it get special variables. OLD and NEW for instance or TG_ARGV[].

If trigger function depends only on NEW is it IMMUTABLE? (With the same NEW it must return the same changed NEW). If trigger function makes SELECTs and change only NEW is it can be declared as STABLE? And etc.

> 18 окт. 2019 г., в 2:41, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> написал(а):
>
> On 10/17/19 4:31 PM, Олег Самойлов wrote:
>> Hi all.
>> According to documentation the words "VOLATILE, STABLE, IMMUTABLE" is somehow useful with trigger functions, for instance mentioned that the AFTER INSERT trigger should be VOLATILE. The question is how this words affect a for each row before insert trigger? Can be some optimisation here?
>
> https://www.postgresql.org/docs/11/xfunc-volatility.html
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2019-10-18 07:04:54 Re: A little confusion about JSON Path
Previous Message Daulat Ram 2019-10-18 05:59:21 Postgres Point in time Recovery (PITR),