/* Start a transaction so our commands have one to play into. */
StartTransactionCommand();
+ /* functions in indexes may want a snapshot set */
+ ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
+
dbRel = heap_open(DatabaseRelationId, AccessShareLock);
/* Must use a table scan, since there's no syscache for pg_database */
/* Start a transaction so our commands have one to play into. */
StartTransactionCommand();
+ /* functions in indexes may want a snapshot set */
+ ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
+
/*
* StartTransactionCommand and CommitTransactionCommand will automatically
* switch to other contexts. We need this one to keep the list of
vacstmt->relation = NULL; /* all tables, or not used if relids != NIL */
vacstmt->va_cols = NIL;
- /*
- * Functions in indexes may want a snapshot set. Note we only need
- * to do this in limited cases, because it'll be done in vacuum()
- * otherwise.
- */
- if (doanalyze && !dovacuum && relids != NIL)
- ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
-
vacuum(vacstmt, relids);
pfree(vacstmt);