pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Jaime Casanova <systemguards@gmail.com>
Cc: Chris Hoover <revoohc@gmail.com>
Cc: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: What happens to transactions durring a pg_dump?
Date: Sat, 21 Jan 2006 19:50:42 -0500
Message-ID: <2754.1137891042@sss.pgh.pa.us> (raw)
In-Reply-To: <20060122002519.GA20969@wolff.to>
References: <1d219a6f0601090922s5224e78emd68cf850b836c2af@mail.gmail.com>
	<20060109174511.GA43775@winnie.fuhr.org>
	<1d219a6f0601091000u45439e1dq1eb8296e8ffa3dba@mail.gmail.com>
	<c2d9e70e0601091222y64e49593lc6f9d7809a05444b@mail.gmail.com>
	<20060122002519.GA20969@wolff.to>

Bruno Wolff III <bruno@wolff.to> writes:
> I don't think that is precisely correct. I believe that the snapshot isn't
> set until the first query is made within the transaction.

Right.  Specifically, any statement *other* than those enumerated in
PortalRunUtility() will set the snapshot.  As of CVS tip (and for
several past releases IIRC), that code looks like:

    /*
     * Set snapshot if utility stmt needs one.    Most reliable way to do this
     * seems to be to enumerate those that do not need one; this is a short
     * list.  Transaction control, LOCK, and SET must *not* set a snapshot
     * since they need to be executable at the start of a serializable
     * transaction without freezing a snapshot.  By extension we allow SHOW
     * not to set a snapshot.  The other stmts listed are just efficiency
     * hacks.  Beware of listing anything that can modify the database --- if,
     * say, it has to update an index with expressions that invoke
     * user-defined functions, then it had better have a snapshot.
     */
    if (!(IsA(utilityStmt, TransactionStmt) ||
          IsA(utilityStmt, LockStmt) ||
          IsA(utilityStmt, VariableSetStmt) ||
          IsA(utilityStmt, VariableShowStmt) ||
          IsA(utilityStmt, VariableResetStmt) ||
          IsA(utilityStmt, ConstraintsSetStmt) ||
    /* efficiency hacks from here down */
          IsA(utilityStmt, FetchStmt) ||
          IsA(utilityStmt, ListenStmt) ||
          IsA(utilityStmt, NotifyStmt) ||
          IsA(utilityStmt, UnlistenStmt) ||
          IsA(utilityStmt, CheckPointStmt)))
        ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
    else
        ActiveSnapshot = NULL;


			regards, tom lane



view thread (7+ messages)

Message-ID: <2754.1137891042@sss.pgh.pa.us>
Permalink:  ../2754.1137891042@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2754.1137891042@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bruno@wolff.to, systemguards@gmail.com, revoohc@gmail.com, mike@fuhr.org
  Subject: Re: What happens to transactions durring a pg_dump?
  In-Reply-To: <2754.1137891042@sss.pgh.pa.us>
  References: <1d219a6f0601090922s5224e78emd68cf850b836c2af@mail.gmail.com> <20060109174511.GA43775@winnie.fuhr.org> <1d219a6f0601091000u45439e1dq1eb8296e8ffa3dba@mail.gmail.com> <c2d9e70e0601091222y64e49593lc6f9d7809a05444b@mail.gmail.com> <20060122002519.GA20969@wolff.to> <2754.1137891042@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox