Re: Where to call SetQuerySnapshot - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Where to call SetQuerySnapshot
Date
Msg-id 13553.1034097685@sss.pgh.pa.us
Whole thread Raw
In response to Re: Where to call SetQuerySnapshot  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I said:
> ...  So I had
> been thinking of pulling it out to postgres.c anyway.  I will do that.

I did this and ended up with a rather long list of statement types that
might need a snapshot:
               elog(DEBUG2, "ProcessUtility");
               /* set snapshot if utility stmt needs one */               /* XXX maybe cleaner to list those that
shouldn'tset one? */               if (IsA(utilityStmt, AlterTableStmt) ||                   IsA(utilityStmt,
ClusterStmt)||                   IsA(utilityStmt, CopyStmt) ||                   IsA(utilityStmt, ExecuteStmt) ||
           IsA(utilityStmt, ExplainStmt) ||                   IsA(utilityStmt, IndexStmt) ||
IsA(utilityStmt,PrepareStmt) ||                   IsA(utilityStmt, ReindexStmt))                   SetQuerySnapshot();
 

(Anything that can call the planner or might create entries in
functional indexes had better set a snapshot, thus stuff like
ReindexStmt has the issue.)

I wonder if we should turn this around, and set a snapshot for all
utility statements that can't show cause why they don't need one.
Offhand, TransactionStmt, FetchStmt, and VariableSet/Show/Reset
might be the only ones that need be excluded.  Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: pg_dump file question
Next
From: Joe Conway
Date:
Subject: Re: Where to call SetQuerySnapshot