I already managed the connection pooling, and what I need is to serialize the result.
If PGresult was a contiguous block, I could have just create buffer and call memcpy for serialization, but structure of result seems much more complicated.
So, I was asking if there is an easy way to achieve serialization
It's wire format is a serialization. That's kind of the point.
I don't understand what you're trying to do here, so it's hard to give a better answer.