Re: libpq CREATE DATABASE operation from multiple treads

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: libpq CREATE DATABASE operation from multiple treads
Дата
Msg-id 2623291.1602187023@sss.pgh.pa.us
обсуждение исходный текст
Ответ на libpq CREATE DATABASE operation from multiple treads  (p.sun.fun@gmail.com)
Ответы Re: libpq CREATE DATABASE operation from multiple treads  (p.sun.fun@gmail.com)
Список pgsql-sql
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 по дате отправления:

Предыдущее
От: p.sun.fun@gmail.com
Дата:
Сообщение: libpq CREATE DATABASE operation from multiple treads
Следующее
От: p.sun.fun@gmail.com
Дата:
Сообщение: Re: libpq CREATE DATABASE operation from multiple treads