Re: transaction safety - Mailing list pgsql-general

From DaVinci
Subject Re: transaction safety
Date
Msg-id 20010213090742.A12461@fangorn.net
Whole thread Raw
In response to transaction safety  (DaVinci <bombadil@wanadoo.es>)
List pgsql-general
On Mon, Feb 12, 2001 at 10:22:30AM -0500, Tom Lane wrote:
> DaVinci <bombadil@wanadoo.es> writes:
> > On Mon, Feb 12, 2001 at 01:08:01PM -0000, Michael Ansley wrote:
> >> Typically, the insert for a person, and for all the associated addresses
> >> would be done in the same transaction so that if the insert for one of the
> >> addresses failed, then the whole lot would role back (perhaps a bit extreme,
> >> but I think that's what you asked for ;-)
>
> >  I thought it is possible to have different transactions opened and insert
> >  data in same table from them. It seems my idea was fault, doesn't it?.
> >  In sumary: locks with inserts are for table and not for tuple. If this is
> >  not true, tell me details, please :)
>
> It's not true.  How did you arrive at that conclusion from what Mike
> said?

 I'll try to explain. Mike said: "in a transaction make an insert and then a
 read in serial current value".

 If in gap between those operations occurs another insert from different
 transaction, then reading serial is not safe.

 In order to understand this well I have made some basic experiments,
 freezing a transaction with an insert and making other transaction with an
 insert to the same table. Second gets frozen until first commit or cancel.
 That is reason of my last message: "locks with inserts are for table and
 not for tuple". Perhaps I didn't explain myself very well or there is some
 detail about locks that I don't understand at all.

 Thanks all for your time.

                                 David




pgsql-general by date:

Previous
From: "Matt Friedman"
Date:
Subject: Vacuum and Owner
Next
From: Jean-Arthur Silve
Date:
Subject: Database Recovery