Re: implicit transaction changes trigger behaviour

2019-09-03 Thread Willy-Bas Loos
Thank you so much, the "stable" thing was it. I'm not sure if it is underdocumented, i clearly didn't adhere to the rule that a stable function " is guaranteed to return the same results given the same arguments for all rows within a single statement". BTW in my example i made a mistake too, but th

Re: implicit transaction changes trigger behaviour

2019-08-29 Thread Tom Lane
Willy-Bas Loos writes: > I currently have a fairly complex use case to solve and one thing i tried > was a deferred constraint trigger. I'm not sure if this solution is the way > to go, but anyway: As i was testing my code, i noticed that the trigger > behaves differently depending on whether or n

Re: implicit transaction changes trigger behaviour

2019-08-29 Thread Luca Ferrari
On Thu, Aug 29, 2019 at 2:16 PM Willy-Bas Loos wrote: > delete from b; > --DELETE 3 Here the trigger is fired 3 times (for each row), and on every single test it finds a row in 'a', that is your variable n_b_type1 is always 1, that causes the trigger (fired on each row) to not abort. If you delet

implicit transaction changes trigger behaviour

2019-08-29 Thread Willy-Bas Loos
Hi, I currently have a fairly complex use case to solve and one thing i tried was a deferred constraint trigger. I'm not sure if this solution is the way to go, but anyway: As i was testing my code, i noticed that the trigger behaves differently depending on whether or not i explicitly use BEGIN a