Re: CREATE DATABASE fails when template1 being accessed ...

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE DATABASE fails when template1 being accessed ...
Date: 2005-05-31 19:08:34
Message-ID: 20050531190834.GB9073@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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"

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-05-31 19:20:32 Re: Deadlock with tsearch2 index ...
Previous Message Hannu Krosing 2005-05-31 19:04:24 Re: Deadlock with tsearch2 index ...