Re: what's the exact command definition in read committed isolation level? - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: what's the exact command definition in read committed isolation level?
Date
Msg-id nf2t00$d49$1@ger.gmane.org
Whole thread Raw
In response to Re: what's the exact command definition in read committed isolation level?  (Jinhua Luo <luajit.io@gmail.com>)
Responses Re: Re: what's the exact command definition in read committed isolation level?
List pgsql-general
Jinhua Luo schrieb am 18.04.2016 um 16:47:
> For trigger, e.g. written in pl/pgsql, each sql command within the
> function may see more new data beyond the (entry) snapshot of outer
> command.

No it will not see "more data")

It runs in the same _transaction_ as the "firing" command and thus sees
**exactly** the same data as the triggering statement

> So if the "command" term in the read committed isolation level only
> refers to outer command (the outer command is the top level command
> send by session client), then it's wrong obviously, so it should
> clarify that the trigger is an rule exception, in other words, the
> commands in trigger should be considered as virtual "outer" commands,
> just like you inline the trigger body below the outer command.

The visibility of data with regards to isolation levels is all about _transactions_ - **not** statements.

Just because you run in auto-commit mode doesn't mean this changes.

With autocommit enabled, the first (or outer) statement starts a _transaction_ and that transaction only ends when
**that**statement is finished.  

Any statement that is execute because e.g. a trigger is fired or the statement calls a function that contains several
statementsis still part of that _transaction_.  

Thomas


pgsql-general by date:

Previous
From: Jinhua Luo
Date:
Subject: Re: what's the exact command definition in read committed isolation level?
Next
From: Tom Lane
Date:
Subject: Re: Re: what's the exact command definition in read committed isolation level?