From: | Dirk Lattermann <dlatt(at)alqualonde(dot)de> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Trigger transaction isolation |
Date: | 2020-09-03 06:20:27 |
Message-ID: | 20200903082027.50efd235@walter |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you, Tom, for this valuable information.
On Tue, 01 Sep 2020 11:02:01 -0400
1Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> visibility rules are the same as for any other function. So the
> answer to the OP's question depends on the transaction's isolation
> level and (for typical PLs) on whether the function is VOLATILE or
> not.
>
> serializable -> the transaction's initial snapshot is used throughout
I suppose by writing serializable, you include repeatable read here,
too?
>
> non serializable, volatile function -> each statement in the function
> takes a fresh snapshot
This is the needed behaviour for the validations I intend to do, then.
>
> non serializable, non-volatile function -> the function uses a single
> snapshot. For a non-deferred trigger, I think it shares the snapshot
> used by the triggering query. Not sure about exactly when the
> snapshot is taken for a deferred trigger.
So this case seems to be trickier than it looks at a first glance.
It depends heavily on the use case, of course, in how far the snapshot
time influences the correctness of a trigger written in this mode.
I suggest adding this to the documentation and will try to use the
commenting function there for it.
Thanks!
Dirk
From | Date | Subject | |
---|---|---|---|
Next Message | Domagoj Smoljanovic | 2020-09-03 09:46:58 | pg_restore causing deadlocks on partitioned tables |
Previous Message | Peter Eisentraut | 2020-09-03 05:01:17 | Re: SSL between Primary and Seconday PostgreSQL DBs |