Re: stable for each row before insert trigger

2019-10-18 Thread Luca Ferrari
On Fri, Oct 18, 2019 at 11:18 AM Олег Самойлов wrote: > > STABLE indicates (It is inappropriate for AFTER triggers that wish to > > query rows modified by the current command.) > > So, STABLE is inappropriate for such trigger, but is appropriate for BEFORE > trigger? > Well, a before trigg

Re: stable for each row before insert trigger

2019-10-18 Thread Олег Самойлов
Luca, I also read this section before ask the question. > 18 окт. 2019 г., в 10:15, Tom Lane написал(а): > > =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= writes: >> According to documentation the words "VOLATILE, STABLE, IMMUTABLE" is >> somehow useful with trigger functions, for instance

Re: stable for each row before insert trigger

2019-10-18 Thread Luca Ferrari
On Fri, Oct 18, 2019 at 9:16 AM Tom Lane wrote: > > =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= writes: > > According to documentation the words "VOLATILE, STABLE, IMMUTABLE" is > > somehow useful with trigger functions, for instance mentioned that the > > AFTER INSERT trigger should be VO

Re: stable for each row before insert trigger

2019-10-18 Thread Tom Lane
=?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= writes: > 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 >

Re: stable for each row before insert trigger

2019-10-17 Thread Олег Самойлов
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

Re: stable for each row before insert trigger

2019-10-17 Thread Adrian Klaver
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 in

stable for each row before insert trigger

2019-10-17 Thread Олег Самойлов
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