Thread: Database variables when copying a database

Database variables when copying a database

From
Christopher Kings-Lynne
Date:
Hi,

When you do this:

CREATE DATABASE test TEMPLATE master;

It doesn't copy any per-database GUC variables,  created by the ALTER 
DATABASE master SET var TO val; command.

Should it?

Chris



Re: Database variables when copying a database

From
Christopher Kings-Lynne
Date:
Anyone thought about this at all yet?  Is it possible to have 
per-database variables that refer to the current database in someway 
that would need to be altered to refer to the new db?

Chris

Christopher Kings-Lynne wrote:
> Hi,
> 
> When you do this:
> 
> CREATE DATABASE test TEMPLATE master;
> 
> It doesn't copy any per-database GUC variables,  created by the ALTER 
> DATABASE master SET var TO val; command.
> 
> Should it?
> 
> Chris
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings


Re: Database variables when copying a database

From
Tom Lane
Date:
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> Anyone thought about this at all yet?

It seems to me that we shouldn't copy them, but I'm having a hard time
putting a finger on why exactly.  I guess it goes along with the fact
that we don't copy the database's owner, and any per-database variable
settings seem to me to be the database owner's decision to make.

Also I refer you to the point made in the manual that CREATE DATABASE is
not intended to be a COPY DATABASE facility.
        regards, tom lane


Re: Database variables when copying a database

From
Christopher Kings-Lynne
Date:
> It seems to me that we shouldn't copy them, but I'm having a hard time
> putting a finger on why exactly.  I guess it goes along with the fact
> that we don't copy the database's owner, and any per-database variable
> settings seem to me to be the database owner's decision to make.

Good points.  The reason I ran into this is because I basically did use 
it as a copy database command to make a development copy of an in-use 
database for a developer to mess with.  However, somethings turned out 
to be broken as it had lost the custom search_path we had set on the 
database that made stuff work.

It occurred to me that it was probably somethign that had not been 
thought of when db variables were invented, rather than somethign 
deliberately avoided.

Chris