Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0078ea

Browse files
committed
Fix another case in which autovacuum would fail while analyzing
expressional indexes. Per report from Brian Hirt.
1 parent 507e07e commit e0078ea

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/commands/vacuum.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.319 2005/11/22 18:17:09 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.320 2006/01/04 19:16:24 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -510,6 +510,14 @@ vacuum(VacuumStmt *vacstmt, List *relids)
510510
* PostgresMain().
511511
*/
512512
StartTransactionCommand();
513+
/*
514+
* Re-establish the transaction snapshot. This is wasted effort
515+
* when we are called as a normal utility command, because the
516+
* new transaction will be dropped immediately by PostgresMain();
517+
* but it's necessary if we are called from autovacuum because
518+
* autovacuum might continue on to do an ANALYZE-only call.
519+
*/
520+
ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
513521
}
514522

515523
if (vacstmt->vacuum)

0 commit comments

Comments
 (0)