Re: Unhappy thoughts about pg_dump and objects inherited from template1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Jan Wieck <janwieck(at)Yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unhappy thoughts about pg_dump and objects inherited from template1
Date: 2000-11-08 15:56:23
Message-ID: 26709.973698983@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> Just seems like we'd be forcing non-standard syntax on ourselves when/if
> CREATE DATABASE becomes CREATE SCHEMA; I would assume that the two
> statements would become synonymous?

No, I don't think so --- we already have WITH LOCATION and WITH
ENCODING, neither of which look like schema-level properties to me.

> [Minor aside: would 'FROM TEMPLATE' be better?]

WITH is already embedded in the CREATE DATABASE syntax.

> Question: if I issue a "CREATE DATABASE foo WITH TEMPLATE 'my-favorite-db'"
> will I just get a copy of the specified database, including data?

If we allow it, that's what would happen. Seems like a potential
security hole though ... should we restrict the set of clonable
templates somehow?

It occurs to me that the current implementation of CREATE DATABASE
assumes that no changes are actively going on in the cloned database;
for example, you'd miss copying any pages that are sitting in dirty
buffers in shared memory. So trying to copy an active database this
way is a recipe for trouble. Probably better restrict it to identified
template databases. Maybe only allow cloning from DBs that are named
templateNNN?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-11-08 16:06:30 Re: Unhappy thoughts about pg_dump and objects inherited from template1
Previous Message Philip Warner 2000-11-08 15:48:50 Re: Unhappy thoughts about pg_dump and objects inherited from template1