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


Fri, 21 May 2004 16:29:35 +0800
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Database variables when copying a database
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

Sat, 22 May 2004 15:52:44 +0800
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Database variables when copying a database
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

Sat, 22 May 2004 13:02:09 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Database variables when copying a database 
> 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

Sun, 23 May 2004 02:14:42 +0800
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: Database variables when copying a database