Database variables when copying a database

Started by Christopher Kings-Lynneover 21 years ago4 messages
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

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

#2Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Christopher Kings-Lynne (#1)
Re: 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:

Show quoted text

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Christopher Kings-Lynne (#2)
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

#4Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Tom Lane (#3)
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