diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2005-11-28 13:34:10 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2005-11-28 13:34:10 +0000 |
commit | 4123dbb75d5e1dbab9f4704c469dba56ec169fc2 (patch) | |
tree | 3b470d2d322f49e572a57481302ae47d145ea3f1 /src/backend | |
parent | 73fa3d9a966a3908ad6c9e481595ba6cc0bf31cc (diff) | |
download | postgresql-4123dbb75d5e1dbab9f4704c469dba56ec169fc2.tar.gz postgresql-4123dbb75d5e1dbab9f4704c469dba56ec169fc2.zip |
Set a snapshot before running analyze on a single table, to avoid a
crash when analyzing tables with expressional indexes.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/postmaster/autovacuum.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index ba9b87ed609..73fea4aef4a 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.5.2.1 2005/11/22 18:23:15 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.5.2.2 2005/11/28 13:34:10 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); |