OK, someone want to answer this? I have always been under the impression that Postgres would not block under these circumstances, however, this is clearly blocking, for no apparently good reason.
I have just run a test on my own server, and this blocking does not happen. Both sessions run independently until each has committed, then displaying information from the other insert, but definitely not blocking. It works exactly as I would have expected.
Anybody???
MikeA
-----Original Message-----
From: DaVinci [mailto:bombadil@wanadoo.es]
Sent: 13 February 2001 10:42
To: Lista PostgreSql
Subject: Re: [GENERAL] transaction safety
On Tue, Feb 13, 2001 at 09:56:18AM -0000, Michael Ansley wrote:
> Hi,
>
> Well, the number is 'locked', because once it's given to you, that's it,
> it's gone from the 'list of available numbers' (i.e.: the sequence).
> However, between the insert, and the read of the ID, if another transaction
> performs an insert, it does NOT affect the ID that the first transaction
> reads (i.e.: your ID read in the first transaction IS definitely still safe,
> it will still read the correct one).
I understand this.
> AND, the first insert does NOT block
> the second insert. The second insert could complete and commit before the
> first one.
But I don't know how to reproduce this part.
If I have two different sessions of psql connected to same database:
psql-1# begin;
psql-2# begin;
psql-1# insert into foo ...;
psql-2# insert into foo ...; <- ¡¡¡Frozen!!!
psql-1# commit; <- psql-2 unfrozen
Why I get this?.
> Does this explain better?
Very well, thanks ;)
David
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
Nick West - Global Infrastructure Manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************