Re: Unhappy thoughts about pg_dump and objects inherited from template1 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Unhappy thoughts about pg_dump and objects inherited from template1
Date
Msg-id 26805.973700026@sss.pgh.pa.us
Whole thread Raw
In response to Re: Unhappy thoughts about pg_dump and objects inherited from template1  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: Unhappy thoughts about pg_dump and objects inherited from template1
Re: Unhappy thoughts about pg_dump and objects inherited from template1
List pgsql-hackers
Philip Warner <pjw@rhyme.com.au> writes:
> It would be nice to have a 'supported' COPY DATABASE (which is what we're
> talking about, really), so I'd vote for being able to use any DB as a
> template, if possible.

> Can we restrict the command to databases that have only one active backend?

No active backends would be more like it.  The problem here is that
there's a race condition much like the one for DROP DATABASE --- there
may be no one connected when you look, but that's no guarantee someone
can't connect right after you look.

We're already overdue for beta, so I really don't want to start
designing/implementing a generalized COPY DATABASE.  (We're not
officially in feature freeze yet, but inventing new features off the
top of our heads doesn't seem like the thing to be doing now.)
I'd like to see a proper fix for the inherited-data problem, though,
since that's clearly a bug in an existing feature.

> Or add an 'istemplate' flag set in pg_database? I don't really like relying
> on specific name formats, if we can avoid it.

That's reasonable I guess.

Do we still need the lastsysoid column in pg_database if we do things
this way?  Seems like what you really want is to suppress all the
objects that are in template0, so you really only need one lastsysoid
value, namely template0's.  The other entries are useless AFAICS.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: Unhappy thoughts about pg_dump and objects inherited from template1
Next
From: Philip Warner
Date:
Subject: Re: Unhappy thoughts about pg_dump and objects inherited from template1