"Matthew T. O'Connor" <matthew@zeut.net> writes:
> 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.
This will not get you very far, because the stat collector is not a real
backend. The checkpointer process might be a better example, but it's
not quite a real backend either. You need to be a real backend to
access shared buffers, locking, etc.
> I don't understand why it thinks I'm in a function,
Because CurrentMemoryContext is not QueryContext (presumably you never
set QueryContext at all). This is a pretty cheesy test but I can't
think of a better one offhand...
regards, tom lane