Re: libpq CREATE DATABASE operation from multiple treads
От | p.sun.fun@gmail.com |
---|---|
Тема | Re: libpq CREATE DATABASE operation from multiple treads |
Дата | |
Msg-id | e532a64faac43651d4bec947409d42365607767f.camel@gmail.com обсуждение исходный текст |
Ответ на | Re: libpq CREATE DATABASE operation from multiple treads (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: libpq CREATE DATABASE operation from multiple treads
|
Список | pgsql-sql |
Hi Tom. Thanks for the quick response. In the function that I execute in each thread, I create a new PGconn at the beginning. I expect that every function caller (thread) should use a unique PGconn. I would not expect that PGconn can be shared between threads. The documentation explicitly says that. On Thu, 2020-10-08 at 15:57 -0400, Tom Lane wrote: > p.sun.fun@gmail.com writes: > > I run this function using only one thread and everything works > > great. > > If I use two threads, the PQresultStatus(res) != PGRES_COMMAND_OK. > > Are you trying to use the same PGconn from multiple threads? That > will not work --- at least not without interlocks that libpq on > its own does not provide. > > > Can the server handle CREATE DATABASE requests in parallel? > > Sure. But they have to be issued over different connections. > Any given connection can only do one thing at a time. > > regards, tom lane
В списке pgsql-sql по дате отправления: