aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2005-11-28 13:35:09 +0000
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2005-11-28 13:35:09 +0000
commitd4fc4ac4c7a96434e5baa8702ead10f7dc693014 (patch)
tree1bd53fe3450564dad21e44396c68293e4930a440 /src
parentec9f81b4ae6ee96c49187ab5b70f92f60f121d08 (diff)
downloadpostgresql-d4fc4ac4c7a96434e5baa8702ead10f7dc693014.tar.gz
postgresql-d4fc4ac4c7a96434e5baa8702ead10f7dc693014.zip
Set a snapshot before running analyze on a single table, to avoid a
crash when analyzing tables with expressional indexes. Per report from Frank van Vugt.
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/autovacuum.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index c3376256f18..4140df6553e 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.6 2005/11/22 18:17:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.7 2005/11/28 13:35:09 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -898,6 +898,14 @@ autovacuum_do_vac_analyze(List *relids, bool dovacuum, bool doanalyze,
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);