Hi,
I've written a custom C-language function that takes a SQL select
statement as it's input parameter, runs the query using the SPI
interface, iterates over all the results of the select using a cursor
and collates the data using a tsearch type binary tree, then walks the
tree to create a f
API that can (for each transaction) setup an internal state,
repeatedly use the state during the execution of a query, and then
free it's state when the query finishes.
I've racked my brain about this but can't think of a simple solution,
even though this appears to be a simple problem,