"One thread restriction is that no two threads attempt to manipulate the same PGconn object at the same time. In particular, you cannot issue concurrent commands from different threads through the same connection object. (If you need to run concurrent commands, use multiple connections.)"
Need to either create a different connection in each thread, maybe using a thread local variable to encapsulate it.
As a workaround, users can set
NumAuthGrabberWorkerThreads = 1
"PGresult objects are normally read-only after creation, and so can be passed around freely between threads. However, if you use any of the PGresult-modifying functions described in Section 31.11 or Section 31.13, it's up to you to avoid concurrent operations on the same PGresult, too."
I don't think that means anything for us because the PGresult objects are processed and released within the worker thread.