Thread: Re: [PATCHES] default database creation with initdb

Re: [PATCHES] default database creation with initdb

From
"Dave Page"
Date:

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 20 June 2005 14:19
> To: Andrew Dunstan
> Cc: Dave Page; Andreas Pflug; Robert Treat; Magnus Hagander;
> pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] [PATCHES] default database creation
> with initdb
>
> I don't see that much of a problem with having createdb etc. hardwire
> postgres instead of template1 as the db-to-connect-to.

OK, new patch posted to -patches that updates all the utilities as well.

The only change I didn't make was in line 3458 (in StartChildProcess) of
postmaster.c - template1 seemed the more sensible option to leave there.
Let me know if you disagree and I'll change it :-)

Regards, Dave.


Re: [PATCHES] default database creation with initdb

From
Tom Lane
Date:
"Dave Page" <dpage@vale-housing.co.uk> writes:
>> I don't see that much of a problem with having createdb etc. hardwire
>> postgres instead of template1 as the db-to-connect-to. 

> OK, new patch posted to -patches that updates all the utilities as well.

I'm going to apply this this evening (ie, before any of the code drifts
under it) unless I hear squawks in the next hour or so, or find some
fatal problem while reviewing.

> The only change I didn't make was in line 3458 (in StartChildProcess) of
> postmaster.c - template1 seemed the more sensible option to leave there.
> Let me know if you disagree and I'll change it :-)

Will look at it.  I'm sure there are a few references that *should* be
template1 ...
        regards, tom lane


Re: [PATCHES] default database creation with initdb

From
Tom Lane
Date:
"Dave Page" <dpage@vale-housing.co.uk> writes:
> OK, new patch posted to -patches that updates all the utilities as well.

Applied.

One thing that neither Dave nor I wanted to touch is pg_autovacuum.
If that gets integrated into the backend by feature freeze then the
question is moot, but if it doesn't then we'll have to decide whether
autovac should preferentially connect to template1 or postgres.  Neither
choice seems real appealing to me: if autovac connects to template1
then it could interfere with CREATE DATABASE, but if it connects to
postgres then it could fail if postgres isn't there.

Now the latter does not bother me if autovac is considered a client,
but it does bother me if autovac is considered part of the backend.
I think that template1 and template0 can reasonably be considered
special from the point of view of the backend --- but I really don't
want postgres to be special in that way.

Another point is that Dave added code to pg_dumpall to not dump the
postgres database.  This seems mistaken to me, so I did not include it
in the applied patch: if someone is doing real work in postgres then
they'll be pretty annoyed if it's not backed up.  But perhaps the
question needs debate.

Any thoughts?
        regards, tom lane


Re: [PATCHES] default database creation with initdb

From
"Michael Paesold"
Date:
Tom Lane wrote:
> Another point is that Dave added code to pg_dumpall to not dump the
> postgres database.  This seems mistaken to me, so I did not include it
> in the applied patch: if someone is doing real work in postgres then
> they'll be pretty annoyed if it's not backed up.  But perhaps the
> question needs debate.
>
> Any thoughts?

You are correct, in my opinion. If one is allowed to add objects to the 
"postgres" database, than it must obviously be backuped. Otherwise this is 
just another way to shoot yourself in the foot. From an "outsiders" point of 
view, the postgres database could just look like roots home directory in 
/root,... would you exclude that from backups?

Best Regards,
Michael Paesold 



Re: [PATCHES] default database creation with initdb

From
Robert Treat
Date:
On Tuesday 21 June 2005 00:12, Tom Lane wrote:
> "Dave Page" <dpage@vale-housing.co.uk> writes:
> > OK, new patch posted to -patches that updates all the utilities as well.
>

If I read the code correctly, the database name will be hardwired to 
"postgres" regardless of the default super user name correct? 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


Re: [PATCHES] default database creation with initdb

From
"Matthew T. O'Connor"
Date:
Tom Lane wrote:

>One thing that neither Dave nor I wanted to touch is pg_autovacuum.
>If that gets integrated into the backend by feature freeze then the
>question is moot, but if it doesn't then we'll have to decide whether
>autovac should preferentially connect to template1 or postgres.  Neither
>choice seems real appealing to me: if autovac connects to template1
>then it could interfere with CREATE DATABASE, but if it connects to
>postgres then it could fail if postgres isn't there.
>
>Now the latter does not bother me if autovac is considered a client,
>but it does bother me if autovac is considered part of the backend.
>I think that template1 and template0 can reasonably be considered
>special from the point of view of the backend --- but I really don't
>want postgres to be special in that way.
>

I'm still hoping that autovac will get integrated so this will be moot, 
but just in case.....

Perhaps pg_autovacuum should try to connect to the postgres database and 
if the connection fails, then it will try to connect to template1.  This 
way autovacuum will work whether the postgres database is there or not.