]> granicus.if.org Git - postgresql/commitdiff
Fix another case in which autovacuum would fail while analyzing
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 4 Jan 2006 19:16:24 +0000 (19:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 4 Jan 2006 19:16:24 +0000 (19:16 +0000)
expressional indexes.  Per report from Brian Hirt.

src/backend/commands/vacuum.c

index 0526d67aaeacecad9afff5488f5e26ff3590dafe..2d654c82233a3955c1494e5bf4b2b792e2799cac 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.319 2005/11/22 18:17:09 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.320 2006/01/04 19:16:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -510,6 +510,14 @@ vacuum(VacuumStmt *vacstmt, List *relids)
                 * PostgresMain().
                 */
                StartTransactionCommand();
+               /*
+                * Re-establish the transaction snapshot.  This is wasted effort
+                * when we are called as a normal utility command, because the
+                * new transaction will be dropped immediately by PostgresMain();
+                * but it's necessary if we are called from autovacuum because
+                * autovacuum might continue on to do an ANALYZE-only call.
+                */
+               ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
        }
 
        if (vacstmt->vacuum)