From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | kynn(at)panix(dot)com |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Q on requirement to connect to a specific DB |
Date: | 2006-05-15 01:31:28 |
Message-ID: | 17844.1147656688@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
<kynn(at)panix(dot)com> writes:
> As far as I know I must connect to *some*
> database, whose role is irrelevant, just so that I can execute "CREATE
> DATABASE ..." from that connection.
Correct.
> I find this puzzling from a design perspective. Why involve some
> irrelevant DB in the process of creating a new one?
Because the backend can't operate without a set of system catalogs
to interrogate. We could maybe have a dummy database that had no
other purpose than to be connected to for specific commands ...
oh wait, that's pretty much what we do have.
> If so, what is the "canonical" database to connect to? (Is this the
> purpose of "template1"?)
Pre-8.1, that was the usual convention, but as of 8.1 we manufacture
an additional "standard" database named "postgres", and that's the
recommended connection target if you have no better alternative.
The reason for the change is that "template1" has the additional
function of being the default database-to-clone for CREATE DATABASE,
and there was too much conflict between those two uses.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Landsmeer | 2006-05-15 06:42:49 | Re: Wondering if anyone could help me |
Previous Message | Sean Davis | 2006-05-15 00:40:57 | Re: Q on requirement to connect to a specific DB |