Re: libpq CREATE DATABASE operation from multiple treads
От | Tom Lane |
---|---|
Тема | Re: libpq CREATE DATABASE operation from multiple treads |
Дата | |
Msg-id | 2631053.1602190588@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: libpq CREATE DATABASE operation from multiple treads (Rob Sargent <robjsargent@gmail.com>) |
Ответы |
Re: libpq CREATE DATABASE operation from multiple treads
|
Список | pgsql-sql |
Rob Sargent <robjsargent@gmail.com> writes: > OK, well that’s a special db. Didn’t know it was that special, though! It's not that special. The issue here is that each session is connecting to template1 and then trying to clone template1. You can't clone an active database, because you might not get a consistent copy. CREATE DATABASE knows that its own session isn't concurrently making any changes, so it allows copying the current database --- but it can't know what some other session is doing, so if it sees some other session is also connected to the source database, it spits up. As I already said, routinely connecting to template1 is pretty bad practice to start with, so the preferred answer is "don't do that". regards, tom lane
В списке pgsql-sql по дате отправления: