Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] It sorta works, but I'm confused about locking

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] It sorta works, but I'm confused about locking
Date: 1998-10-02 01:20:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Tom Lane wrote:
> > I can imagine some cases where you would want to get a lock and keep it
> > until the end of the transaction, and other times when you would want to
> > release it before transaction end.
> I guess I'm not understanding something.  How can it ever be correct
> practice to release a lock before transaction end?  For example, if I
Postgres does this for system tables only.

> write some changes in a table, and then release the lock, wouldn't that
> allow other backends to see the not-yet-committed changes?  What if I
No. Backend uses xmin/xmax to know is tuple visible or not.

> then abort my transaction?  Now the other backends have acted on
> information they should never have seen at all.

Backend will see that xmin(xmax) is not committed.


In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-10-02 01:41:55
Subject: Re: [HACKERS] rules ON SELECT
Previous:From: Tom LaneDate: 1998-10-02 00:29:17
Subject: Re: [HACKERS] Proper cleanup at backend exit

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group