Joshua Tolley <eggyknap(at)gmail(dot)com> writes:
> Makes sense on both counts. Thanks for the help. How does the attached look?
Applied with minor corrections, mainly around the state save/restore
logic. I also put in some code to fix the memory leak noted by Tim Bunce,
but am waiting for some confirmation that it's right before
back-patching the pre-existing bug of the same ilk.
regards, tom lane