mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
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.
This commit is contained in:
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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->relation = NULL; /* all tables, or not used if relids != NIL */
|
||||||
vacstmt->va_cols = 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);
|
vacuum(vacstmt, relids);
|
||||||
|
|
||||||
pfree(vacstmt);
|
pfree(vacstmt);
|
||||||
|
Reference in New Issue
Block a user