Re: Where are updates from inside transactions visible?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Rob Richardson <Rob(dot)Richardson(at)rad-con(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Where are updates from inside transactions visible?
Date: 2008-10-21 14:21:34
Message-ID: 48FDE56E.1010301@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rob Richardson wrote:
> Greetings again!
>
> Suppose I have a table named "myTable" with fields named "item" and
> "value". Item X has a value of 1. Inside a C++ application, I begin a
> transaction, open the table, change Item X's value to 2, and go to
> sleep. The transaction is still active. In PGAdmin, I open an SQL
> window and execute "select * from myTable". What value do I see for
> item X? Will it still be 1 because the transaction in which it was
> changed to 2 is still open?

Yes, in both the READ COMMITTED and SERIALIZABLE isolation levels.
"Dirty" reads, ie reads of uncomitted data, are AFAIK just not possible
in PostgreSQL (though one uncommitted transaction can still affect
another though locks etc).

If you're unsure of these things, (a) read the excellent documentation
available on transaction isolation levels, and (b) test with multiple
simultaneous psql sessions.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-10-21 14:36:20 Re: exposing more parse was: Re: tsearch2: setting weights on tsquery
Previous Message Simon Riggs 2008-10-21 14:15:12 Re: [HACKERS] Hot Standby utility and administrator functions