"Gunkel, Marc B" <mgunke(at)sandia(dot)gov> writes:
> Can each client thread have its own connection?
That should work.
> What happens if multiple threads share one connection? For instance, can one
> thread open a connection and another thread close it?
Not a good idea unless you provide a mutex to ensure that only one
thread manipulates the PGconn object at a time.
Basically, libpq is thread-safe (in recent releases) but not thread-aware.
regards, tom lane