Problem with "create database ... with template "
От | Oleg Bartunov |
---|---|
Тема | Problem with "create database ... with template " |
Дата | |
Msg-id | Pine.LNX.4.64.0705092105280.12152@sn.sai.msu.ru обсуждение исходный текст |
Ответы |
Re: Problem with "create database ... with template "
|
Список | pgsql-hackers |
Hi there, 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", I modelled situation in clean environment with very simple perl script ( FreeBSD 6.2-STABLE, postgresql-8.2.3 from ports ) and was able to reproduce the problem. There were no other connections ( I checked log ). I tried shell script and got the same problem. Is this a known problem ? perl testcreatedb.pl Repeat #:1 Repeat #:2 Repeat #:3 Repeat #:4 Repeat #:5 Repeat #:6 Repeat #:7 Repeat #:8 Repeat #:9 Repeat #:10 Repeat #:11 Repeat #:12 Repeat #:13 Repeat #:14 Repeat #:15 Repeat #:16 DBD::Pg::db do failed: ERROR: source database "yyy" is being accessed by other users DBD::Pg::db do failed: ERROR: source database "yyy" is being accessed by other users ----------- cut here ----------- #!/usr/bin/perl use strict; use DBI; my $dbh; my $rv = undef; foreach my $i ( 1..100) { $dbh = DBI->connect('dbi:Pg:database=yyy;host=msk2.socionet.ru;port=5432','db_user','',{ RaiseError => 1}) or die "Can'tconnect to database !\n"; print STDERR "Repeat #:$i\n"; $rv = $dbh->do('drop database xxx'); $rv = $dbh->do('create database xxx with TEMPLATE=yyy'); print STDERR "error creating database: $rv\n" if ( $rv ne '0E0' ); $dbh->disconnect; --------------- cut here ------------- Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83
В списке pgsql-hackers по дате отправления: