On Wed, 9 May 2007, Tom Lane wrote:

Oleg Bartunov <[EMAIL PROTECTED]> writes:
I'm investigating a problem my client experienced with
"create database xxx with template=yyy" - they often get error
"ERROR:  source database "yyy" is being accessed by other users",

Your test case simply shows that it takes a finite amount of time for
the previous backend to exit; depending on scheduler priorities it's
possible for the next instance to connect and try to CREATE DATABASE
before the previous one is gone.  My suggestion would be to connect
to some other database besides the one being copied.

I tried that connecting to template1, but it doesn't helped. The problem
occurs even if I repeat 'drop;create' in one connection (the same backend).

while true do
 drop database
 create database with template

Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to