Re: Strange Behavior with Serializable Transcations - Mailing list pgsql-general

From Tom Lane
Subject Re: Strange Behavior with Serializable Transcations
Date
Msg-id 7950.1151527669@sss.pgh.pa.us
Whole thread Raw
In response to Re: Strange Behavior with Serializable Transcations  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> I think the issue here is that transaction begin is not when you type
> "begin" but at your first actual query. You can obviously only start a
> transaction once you know what serialisation level you want, and you
> don't see that till after the begin.

Right, the snapshot does not become set until you do a non-utility
command (normally, SELECT/INSERT/UPDATE/DELETE).  This is a feature, not
a bug, because it lets the transaction take table locks before its
snapshot becomes set.  I believe the Fine Manual's discussion of
concurrency includes some examples where such locks are needed ...

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: unusual "relation xxx does not exist" problem
Next
From: "Bill Eaton"
Date:
Subject: Re: unusual "relation xxx does not exist" problem