Hello, I'm playing with creating an auto vacuum daemon, but it is my first time inside the pg source code and I'm a bit lost.
I have gotten as far as having a vacuum daemon created on postmaster startup. It's just a fork from the postmaster, cribbed mostly from the stat collector code. Inside the main loop of the autovac daemon, I am trying to call vacuum() but I get the following error: FATAL: VACUUM cannot be executed from a function I don't understand why it thinks I'm in a function, I believe the error is being generated by this is vacuum.c: /* Running VACUUM from a function would free the function context */ if (vacstmt->vacuum && !MemoryContextContains(QueryContext, vacstmt)) elog(ERROR, "%s cannot be executed from a function", stmttype); So, I assume it has something to do with the memory context that I'm in when I call the vacuum command, so I have been playing with switching contexts and such, but I have had no luck, obviously I don't really know what is going on here. The code snippet that is actually calling the vacuum looks like this: { VacuumStmt *n = makeNode(VacuumStmt); n->vacuum = true; n->analyze = false; n->full = false; n->freeze = false; n->verbose = false; n->relation = NULL; n->va_cols = NIL; vacuum(n); } Any help would be greatly appreciated. Thanks, Matt ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]