Re: CREATE DATABASE fails when template1 being accessed ... - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: CREATE DATABASE fails when template1 being accessed ...
Date
Msg-id 20050531190834.GB9073@surnet.cl
Whole thread Raw
In response to CREATE DATABASE fails when template1 being accessed ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
List pgsql-hackers
On Tue, May 31, 2005 at 02:53:41PM -0300, Marc G. Fournier wrote:

> ERROR:  source database "template1" is being accessed by other users
> 
> Why is this not allowed?  Not that there is generally a reason to be in 
> template1, but am curious as to why it prevents a new DB from being 
> created if someone is connected to it ...

Because we copy the files directly.  So if someone modifies one file in
the middle of the copy, or, say, we copy one index and later the table
and someone inserts into a table in the middle, then the new database is
in an inconsistent state.

There has been talk about fixing this in the past, but conclusion seems
to be "too hard to fix for too little benefit."

-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"


pgsql-hackers by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: CREATE DATABASE fails when template1 being accessed ...
Next
From: Tom Lane
Date:
Subject: Re: Deadlock with tsearch2 index ...