|
10 | 10 | * |
11 | 11 | * |
12 | 12 | * IDENTIFICATION |
13 | | - * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.7 2005/11/28 13:35:09 alvherre Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.8 2005/11/28 17:23:11 alvherre Exp $ |
14 | 14 | * |
15 | 15 | *------------------------------------------------------------------------- |
16 | 16 | */ |
@@ -495,6 +495,9 @@ process_whole_db(void) |
495 | 495 | /* Start a transaction so our commands have one to play into. */ |
496 | 496 | StartTransactionCommand(); |
497 | 497 |
|
| 498 | + /* functions in indexes may want a snapshot set */ |
| 499 | + ActiveSnapshot = CopySnapshot(GetTransactionSnapshot()); |
| 500 | + |
498 | 501 | dbRel = heap_open(DatabaseRelationId, AccessShareLock); |
499 | 502 |
|
500 | 503 | /* Must use a table scan, since there's no syscache for pg_database */ |
@@ -556,6 +559,9 @@ do_autovacuum(PgStat_StatDBEntry *dbentry) |
556 | 559 | /* Start a transaction so our commands have one to play into. */ |
557 | 560 | StartTransactionCommand(); |
558 | 561 |
|
| 562 | + /* functions in indexes may want a snapshot set */ |
| 563 | + ActiveSnapshot = CopySnapshot(GetTransactionSnapshot()); |
| 564 | + |
559 | 565 | /* |
560 | 566 | * StartTransactionCommand and CommitTransactionCommand will automatically |
561 | 567 | * switch to other contexts. We need this one to keep the list of |
@@ -898,14 +904,6 @@ autovacuum_do_vac_analyze(List *relids, bool dovacuum, bool doanalyze, |
898 | 904 | vacstmt->relation = NULL; /* all tables, or not used if relids != NIL */ |
899 | 905 | vacstmt->va_cols = NIL; |
900 | 906 |
|
901 | | - /* |
902 | | - * Functions in indexes may want a snapshot set. Note we only need |
903 | | - * to do this in limited cases, because it'll be done in vacuum() |
904 | | - * otherwise. |
905 | | - */ |
906 | | - if (doanalyze && !dovacuum && relids != NIL) |
907 | | - ActiveSnapshot = CopySnapshot(GetTransactionSnapshot()); |
908 | | - |
909 | 907 | vacuum(vacstmt, relids); |
910 | 908 |
|
911 | 909 | pfree(vacstmt); |
|
0 commit comments