Re: what's the exact command definition in read committed isolation level?

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: what's the exact command definition in read committed isolation level?
Дата
Msg-id nf2t00$d49$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: what's the exact command definition in read committed isolation level?  (Jinhua Luo <luajit.io@gmail.com>)
Ответы Re: Re: what's the exact command definition in read committed isolation level?
Список 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 по дате отправления:

Предыдущее
От: Jinhua Luo
Дата:
Сообщение: Re: what's the exact command definition in read committed isolation level?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Re: what's the exact command definition in read committed isolation level?