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

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vadim Mikheev <vadim(at)krs(dot)ru>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] It sorta works, but I'm confused about locking
Date: 1998-10-02 01:47:13
Message-ID: 29738.907292833@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Vadim Mikheev <vadim(at)krs(dot)ru> writes:
> Tom Lane wrote:
>> 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
>> 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.

Ah, some light dawns.  Thanks for the clue!

> Postgres does this for system tables only.

OK, so what is good coding practice?  Always release write lock after
operating on a system table?  Or is that only good some of the time,
and if so what's the consideration?

			regards, tom lane

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-10-02 01:48:59
Subject: Re: [HACKERS] SQL92
Previous:From: Tom LaneDate: 1998-10-02 01:42:01
Subject: Re: [HACKERS] Patch for libpgtcl

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