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 statements is still part of that 
_transaction_. 

Thomas




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to