Frank van Vugt wrote:

> Since I started to use v8.1 I've been seeing incidental segfaults of the 
> autovacuum process, probably when it is kicking in at some particular point 
> during the pg_restore of a database:

Hum, I'm unable to reproduce the problem here; could you give me the
code for the functions in the functional indexes for tables 164956 or
227469?  They must be non-trivial SQL functions AFAICT (I'm rather
unable to figure out their shape based only on the backtrace.)

The attached patch should correct the problem, but I'd like to make sure
it does ...

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Index: src/backend/postmaster/autovacuum.c
===================================================================
RCS file: /home/alvherre/cvs/pgsql/src/backend/postmaster/autovacuum.c,v
retrieving revision 1.6
diff -c -r1.6 autovacuum.c
*** src/backend/postmaster/autovacuum.c 22 Nov 2005 18:17:17 -0000      1.6
--- src/backend/postmaster/autovacuum.c 28 Nov 2005 12:55:26 -0000
***************
*** 898,903 ****
--- 898,911 ----
        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);
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to