default database creation with initdb

Started by Andreas Pflugover 21 years ago2 messagespatches
Jump to latest
#1Andreas Pflug
pgadmin@pse-consulting.de

As per discussion on -hackers the attached patch creates the 'default'
database at initdb time as a default target for initial connections to
keep template1 free from connections and available as template source.

I consider this DB a system object, so it's created before
make_template0 sets the last_system_oid (wondering why template0 isn't
considered a system db too)

Regards,
Andreas

Attachments:

initdb-default.patchtext/x-patch; name=initdb-default.patchDownload+35-0
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andreas Pflug (#1)
Re: default database creation with initdb

Andreas Pflug <pgadmin@pse-consulting.de> writes:

+		"CREATE DATABASE \"default\";\n",
+		"REVOKE CREATE,TEMPORARY ON DATABASE \"default\" FROM public;\n",

Uh, why the rights revocation? That makes the thing essentially useless
... except to superusers, who will not be affected anyway. I don't
think this is a sane default.

In any case, fixing initdb for this is trivial. I count something north
of 160 other references to template1 in the current sources, scattered
across 60+ files. Every one of those has to be looked at and possibly
changed.

regards, tom lane