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

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: what's the exact command definition in read committed isolation level?
Date: 2016-04-18 15:03:28
Message-ID: nf2t00$d49$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 statements is still part of that _transaction_.

Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-04-18 15:16:24 Re: Re: what's the exact command definition in read committed isolation level?
Previous Message Jinhua Luo 2016-04-18 14:47:48 Re: what's the exact command definition in read committed isolation level?