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

Re: [PATCH] Proposed: Have SPI_connect fail if there is no current snapshot

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Proposed: Have SPI_connect fail if there is no current snapshot
Date: 2005-08-14 17:02:54
Message-ID: 680.1124038974@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> You can lock a table even while you have no valid snapshot?

Certainly.  In serializable mode, you really need to be able to take out
locks before the snapshot is set --- TFM explains:

    Note also that if one is relying on explicit locking to prevent
    concurrent changes, one should use Read Committed mode, or in
    Serializable mode be careful to obtain the lock(s) before performing
    queries. A lock obtained by a serializable transaction guarantees that
    no other transactions modifying the table are still running, but if the
    snapshot seen by the transaction predates obtaining the lock, it may
    predate some now-committed changes in the table. A serializable
    transaction's snapshot is actually frozen at the start of its first
    query or data-modification command (SELECT, INSERT, UPDATE, or DELETE),
    so it's possible to obtain locks explicitly before the snapshot is
    frozen.

			regards, tom lane

In response to

pgsql-patches by date

Next:From: Andreas PflugDate: 2005-08-14 17:11:34
Subject: Re: [HACKERS] For review: Server instrumentation patch
Previous:From: Tom LaneDate: 2005-08-14 16:58:55
Subject: Re: [HACKERS] For review: Server instrumentation patch

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