Thread: template0 database comment

template0 database comment

From
Bruce Momjian
Date:
People are confused about what template0 is for, so I created the
attached one-line patch to add a database comment to template0. No
initdb, I assume, becuase it is just a comment.

I plan to work on more system table and view comments for 9.2.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
new file mode 100644
index acd2514..ba9b688
*** a/src/bin/initdb/initdb.c
--- b/src/bin/initdb/initdb.c
*************** make_template0(void)
*** 1976,1981 ****
--- 1976,1983 ----
          "REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n",
          "REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n",

+         "COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
+
          /*
           * Finally vacuum to clean up dead rows in pg_database
           */

Re: template0 database comment

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
> People are confused about what template0 is for, so I created the
> attached one-line patch to add a database comment to template0. No
> initdb, I assume, becuase it is just a comment. 
> +         "COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",

No objection to the concept, but the actual text of this comment is
approximately 100% wrong.
        regards, tom lane


Re: template0 database comment

From
Dave Page
Date:
On 3/12/11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Bruce Momjian <bruce@momjian.us> writes:
>> People are confused about what template0 is for, so I created the
>> attached one-line patch to add a database comment to template0. No
>> initdb, I assume, becuase it is just a comment.
>
>> +         "COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
>
> No objection to the concept, but the actual text of this comment is
> approximately 100% wrong.
>

I'd like to lodge a formal objection to the use of the word
'approximately' in the above comment.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: template0 database comment

From
Bruce Momjian
Date:
Dave Page wrote:
> On 3/12/11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> >> People are confused about what template0 is for, so I created the
> >> attached one-line patch to add a database comment to template0. No
> >> initdb, I assume, becuase it is just a comment.
> >
> >> +         "COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
> >
> > No objection to the concept, but the actual text of this comment is
> > approximately 100% wrong.
> >
> 
> I'd like to lodge a formal objection to the use of the word
> 'approximately' in the above comment.

OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
don' know what template0 is used for either.  Is it pg_dumpall perhaps?

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Thom Brown
Date:
On 12 March 2011 13:59, Bruce Momjian <bruce@momjian.us> wrote:
> Dave Page wrote:
>> On 3/12/11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> > Bruce Momjian <bruce@momjian.us> writes:
>> >> People are confused about what template0 is for, so I created the
>> >> attached one-line patch to add a database comment to template0. No
>> >> initdb, I assume, becuase it is just a comment.
>> >
>> >> +          "COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
>> >
>> > No objection to the concept, but the actual text of this comment is
>> > approximately 100% wrong.
>> >
>>
>> I'd like to lodge a formal objection to the use of the word
>> 'approximately' in the above comment.
>
> OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
> don' know what template0 is used for either.  Is it pg_dumpall perhaps?

'original template database' ?

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: template0 database comment

From
Bruce Momjian
Date:
Thom Brown wrote:
> On 12 March 2011 13:59, Bruce Momjian <bruce@momjian.us> wrote:
> > Dave Page wrote:
> >> On 3/12/11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> > Bruce Momjian <bruce@momjian.us> writes:
> >> >> People are confused about what template0 is for, so I created the
> >> >> attached one-line patch to add a database comment to template0. No
> >> >> initdb, I assume, becuase it is just a comment.
> >> >
> >> >> + ? ? ? ? ?"COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
> >> >
> >> > No objection to the concept, but the actual text of this comment is
> >> > approximately 100% wrong.
> >> >
> >>
> >> I'd like to lodge a formal objection to the use of the word
> >> 'approximately' in the above comment.
> >
> > OK, funny guys. ?;-) ?Can someone give me the right text. ?Obviously I
> > don' know what template0 is used for either. ?Is it pg_dumpall perhaps?
> 
> 'original template database' ?

I like that.  Perhaps "unmodified template database'?

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Christopher Browne
Date:
On Sat, Mar 12, 2011 at 8:59 AM, Bruce Momjian <bruce@momjian.us> wrote:
> Dave Page wrote:
>> On 3/12/11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> > Bruce Momjian <bruce@momjian.us> writes:
>> >> People are confused about what template0 is for, so I created the
>> >> attached one-line patch to add a database comment to template0. No
>> >> initdb, I assume, becuase it is just a comment.
>> >
>> >> +          "COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
>> >
>> > No objection to the concept, but the actual text of this comment is
>> > approximately 100% wrong.
>> >
>>
>> I'd like to lodge a formal objection to the use of the word
>> 'approximately' in the above comment.
>
> OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
> don' know what template0 is used for either.  Is it pg_dumpall perhaps?

Whaa?!?!

pg_dump has nothing to do with it.  Only used by createdb

Possibilities include:
- 'base template database'
- 'base template (used if template1 is corrupted)'
- 'backup template (use if template1 corrupted)'

Contrast with template1
- 'default template for creation of new databases'

I dunno that those are the *best* wordings, but they may suggest one.
--
http://linuxfinances.info/info/linuxdistributions.html


Re: template0 database comment

From
Christopher Browne
Date:
On Sat, Mar 12, 2011 at 9:14 AM, Bruce Momjian <bruce@momjian.us> wrote:
> I like that.  Perhaps "unmodified template database'?

"why" tends to be more important than "what", particularly to a
confused DBA who's trying to figure out "why do they have all these
extra databases???"

Perhaps...
"backup template database - normally immutable, used if template1 is corrupted"


--
http://linuxfinances.info/info/linuxdistributions.html


Re: template0 database comment

From
Bruce Momjian
Date:
Christopher Browne wrote:
> On Sat, Mar 12, 2011 at 8:59 AM, Bruce Momjian <bruce@momjian.us> wrote:
> > Dave Page wrote:
> >> On 3/12/11, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> > Bruce Momjian <bruce@momjian.us> writes:
> >> >> People are confused about what template0 is for, so I created the
> >> >> attached one-line patch to add a database comment to template0. No
> >> >> initdb, I assume, becuase it is just a comment.
> >> >
> >> >> + ? ? ? ? ?"COMMENT ON DATABASE template0 IS 'only used by pg_dump';\n",
> >> >
> >> > No objection to the concept, but the actual text of this comment is
> >> > approximately 100% wrong.
> >> >
> >>
> >> I'd like to lodge a formal objection to the use of the word
> >> 'approximately' in the above comment.
> >
> > OK, funny guys. ?;-) ?Can someone give me the right text. ?Obviously I
> > don' know what template0 is used for either. ?Is it pg_dumpall perhaps?
> 
> Whaa?!?!
> 
> pg_dump has nothing to do with it.  Only used by createdb
> 
> Possibilities include:
> - 'base template database'
> - 'base template (used if template1 is corrupted)'
> - 'backup template (use if template1 corrupted)'
> 
> Contrast with template1
> - 'default template for creation of new databases'
> 
> I dunno that those are the *best* wordings, but they may suggest one.

I thought the big deal with template0 was it was used to find items that
were added to template1 by pg_dumpall.

I think Thom's idea of not describing its use but its contents might be
best, maybe "unmodifiable template database".

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Greg Stark
Date:
On Sat, Mar 12, 2011 at 1:59 PM, Bruce Momjian <bruce@momjian.us> wrote:
> OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
> don' know what template0 is used for either.  Is it pg_dumpall perhaps?
>

template0: unmodifiable pristine empty database
template1: default template for new databases



--
greg


Re: template0 database comment

From
Bruce Momjian
Date:
Greg Stark wrote:
> On Sat, Mar 12, 2011 at 1:59 PM, Bruce Momjian <bruce@momjian.us> wrote:
> > OK, funny guys. ?;-) ?Can someone give me the right text. ?Obviously I
> > don' know what template0 is used for either. ?Is it pg_dumpall perhaps?
> >
> 
> template0: unmodifiable pristine empty database
> template1: default template for new databases

I think I like "unmodifiable empty database".

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Tom Lane
Date:
Greg Stark <gsstark@mit.edu> writes:
> On Sat, Mar 12, 2011 at 1:59 PM, Bruce Momjian <bruce@momjian.us> wrote:
>> OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
>> don' know what template0 is used for either.  Is it pg_dumpall perhaps?

> template0: unmodifiable pristine empty database
> template1: default template for new databases

Yeah, I think that the right way to approach this is to have initdb
comment *both* of those databases.  I don't like that specific wording
for template0 though.  Maybe

template0: unmodified copy of original template1 database
template1: default template for new databases

The problem with Greg's wording is that it's falsifiable: it is possible
for someone to modify template0 if they're determined to mess things up.
So a description like "unmodifiable" is promising too much.

Shouldn't the "postgres" database get a comment too, while we're at it?
Perhaps "default database to connect to"?
        regards, tom lane


Re: template0 database comment

From
Peter Eisentraut
Date:
On lör, 2011-03-12 at 12:01 -0500, Tom Lane wrote:
> Shouldn't the "postgres" database get a comment too, while we're at
> it?  Perhaps "default database to connect to"?

That's not actually true, though.  Maybe it's the "default database used
by administration programs"?  In practice it might be "some otherwise
unused database that's occasionally useful". ;-)



Re: template0 database comment

From
Greg Stark
Date:
On Sat, Mar 12, 2011 at 5:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The problem with Greg's wording is that it's falsifiable: it is possible
> for someone to modify template0 if they're determined to mess things up.
> So a description like "unmodifiable" is promising too much.
>

Eh, it's possible for someone to make any part of the documentation
wrong if they're determined to mess things up enough. "Empty" is not
even technically correct since it has all the system tables and stuff.
But I think there's a point of diminishing returns where if we try to
come up with something that's technically 100% true it won't help a
user understand the key attributes that make template0 useful. Under
normal usage it has no user objects in it and it is hard to change
that which tries to guarantee that that fact remains true.

-- 
greg


Re: template0 database comment

From
Robert Haas
Date:
On Mar 12, 2011, at 12:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Greg Stark <gsstark@mit.edu> writes:
>> On Sat, Mar 12, 2011 at 1:59 PM, Bruce Momjian <bruce@momjian.us> wrote:
>>> OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
>>> don' know what template0 is used for either.  Is it pg_dumpall perhaps?
> 
>> template0: unmodifiable pristine empty database
>> template1: default template for new databases
> 
> Yeah, I think that the right way to approach this is to have initdb
> comment *both* of those databases.  I don't like that specific wording
> for template0 though.  Maybe
> 
> template0: unmodified copy of original template1 database
> template1: default template for new databases
> 
> The problem with Greg's wording is that it's falsifiable: it is possible
> for someone to modify template0 if they're determined to mess things up.
> So a description like "unmodifiable" is promising too much.
> 
> Shouldn't the "postgres" database get a comment too, while we're at it?
> Perhaps "default database to connect to"?

A preposition is something you should try not to end a sentence with.

...Robert


Re: template0 database comment

From
Greg Stark
Date:
On Sat, Mar 12, 2011 at 8:42 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> A preposition is something you should try not to end a sentence with.
>

Something to keep in mind when someone localises Postgres for Latin
which has this rule.

-- 
greg


Re: template0 database comment

From
Andrew Dunstan
Date:

On 03/12/2011 04:24 PM, Greg Stark wrote:
> On Sat, Mar 12, 2011 at 8:42 PM, Robert Haas<robertmhaas@gmail.com>  wrote:
>> A preposition is something you should try not to end a sentence with.
>>
> Something to keep in mind when someone localises Postgres for Latin
> which has this rule.
>


I assume Robert's comment was in jest, since it was in breach of the 
rule it was stating.

cheers

andrew


Re: template0 database comment

From
Bruce Momjian
Date:
Tom Lane wrote:
> Greg Stark <gsstark@mit.edu> writes:
> > On Sat, Mar 12, 2011 at 1:59 PM, Bruce Momjian <bruce@momjian.us> wrote:
> >> OK, funny guys.  ;-)  Can someone give me the right text.  Obviously I
> >> don' know what template0 is used for either.  Is it pg_dumpall perhaps?
> 
> > template0: unmodifiable pristine empty database
> > template1: default template for new databases
> 
> Yeah, I think that the right way to approach this is to have initdb
> comment *both* of those databases.  I don't like that specific wording
> for template0 though.  Maybe
> 
> template0: unmodified copy of original template1 database
> template1: default template for new databases

Tom, the current comment for "template1" is "default template database".
Do you like your above wording better?  It does make it slighly longer.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
> Tom Lane wrote:
>> Yeah, I think that the right way to approach this is to have initdb
>> comment *both* of those databases.  I don't like that specific wording
>> for template0 though.  Maybe
>> 
>> template0: unmodified copy of original template1 database
>> template1: default template for new databases

> Tom, the current comment for "template1" is "default template database".
> Do you like your above wording better?  It does make it slighly longer.

Actually that's Greg's wording.  Yeah I do like it better.  If you don't
already know what a template database is, "template1: default template
database" is going to convey precisely nothing to you.  Greg's version
at least gives you the information that it has got something to do with
making new databases, which would probably be enough to prompt people to
go look in the right part of the docs.
        regards, tom lane


Re: template0 database comment

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Tom Lane wrote:
> >> Yeah, I think that the right way to approach this is to have initdb
> >> comment *both* of those databases.  I don't like that specific wording
> >> for template0 though.  Maybe
> >>
> >> template0: unmodified copy of original template1 database
> >> template1: default template for new databases
>
> > Tom, the current comment for "template1" is "default template database".
> > Do you like your above wording better?  It does make it slighly longer.
>
> Actually that's Greg's wording.  Yeah I do like it better.  If you don't
> already know what a template database is, "template1: default template
> database" is going to convey precisely nothing to you.  Greg's version
> at least gives you the information that it has got something to do with
> making new databases, which would probably be enough to prompt people to
> go look in the right part of the docs.

OK, I have modified the comments to be clearer about their purpose:

    test=> \l+
       Name    |                Description
    -----------+--------------------------------------------
     postgres  | default administrative connection database
     template0 | unmodifiable empty database
     template1 | default template for new databases

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
new file mode 100644
index acd2514..b2da1cf
*** a/src/bin/initdb/initdb.c
--- b/src/bin/initdb/initdb.c
*************** make_template0(void)
*** 1976,1981 ****
--- 1976,1983 ----
          "REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n",
          "REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n",

+         "COMMENT ON DATABASE template0 IS 'unmodifiable empty database';\n",
+
          /*
           * Finally vacuum to clean up dead rows in pg_database
           */
*************** make_postgres(void)
*** 2011,2016 ****
--- 2013,2019 ----
      const char **line;
      static const char *postgres_setup[] = {
          "CREATE DATABASE postgres;\n",
+         "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",
          NULL
      };

diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h
new file mode 100644
index 6419d65..ee4c858
*** a/src/include/catalog/pg_database.h
--- b/src/include/catalog/pg_database.h
*************** typedef FormData_pg_database *Form_pg_da
*** 71,77 ****
  #define Anum_pg_database_datacl            12

  DATA(insert OID = 1 (  template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_));
! SHDESCR("default template database");
  #define TemplateDbOid            1

  #endif   /* PG_DATABASE_H */
--- 71,77 ----
  #define Anum_pg_database_datacl            12

  DATA(insert OID = 1 (  template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_));
! SHDESCR("default template for new databases");
  #define TemplateDbOid            1

  #endif   /* PG_DATABASE_H */

Re: template0 database comment

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> On l?r, 2011-03-12 at 12:01 -0500, Tom Lane wrote:
> > Shouldn't the "postgres" database get a comment too, while we're at
> > it?  Perhaps "default database to connect to"?
>
> That's not actually true, though.  Maybe it's the "default database used
> by administration programs"?  In practice it might be "some otherwise
> unused database that's occasionally useful". ;-)

Based on previous discussion I have developed a patch to add comments
for 'postgres' and 'template0' databases:

    postgres=> \l+
    ...
     postgres  | default administrative database
     template0 | unmodifiable empty database
     template1 | default template database

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
new file mode 100644
index acd2514..2397932
*** a/src/bin/initdb/initdb.c
--- b/src/bin/initdb/initdb.c
*************** make_template0(void)
*** 1976,1981 ****
--- 1976,1983 ----
          "REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n",
          "REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n",

+         "COMMENT ON DATABASE template0 IS 'unmodifiable empty database';\n",
+
          /*
           * Finally vacuum to clean up dead rows in pg_database
           */
*************** make_postgres(void)
*** 2011,2016 ****
--- 2013,2019 ----
      const char **line;
      static const char *postgres_setup[] = {
          "CREATE DATABASE postgres;\n",
+         "COMMENT ON DATABASE postgres IS 'default administrative database';\n",
          NULL
      };


Re: template0 database comment

From
Bruce Momjian
Date:
Applied.  I did not bump the catalog version because they are just
comments.  I assume that is the right procedure.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > Tom Lane wrote:
> > >> Yeah, I think that the right way to approach this is to have initdb
> > >> comment *both* of those databases.  I don't like that specific wording
> > >> for template0 though.  Maybe
> > >> 
> > >> template0: unmodified copy of original template1 database
> > >> template1: default template for new databases
> > 
> > > Tom, the current comment for "template1" is "default template database".
> > > Do you like your above wording better?  It does make it slighly longer.
> > 
> > Actually that's Greg's wording.  Yeah I do like it better.  If you don't
> > already know what a template database is, "template1: default template
> > database" is going to convey precisely nothing to you.  Greg's version
> > at least gives you the information that it has got something to do with
> > making new databases, which would probably be enough to prompt people to
> > go look in the right part of the docs.
> 
> OK, I have modified the comments to be clearer about their purpose:
> 
>     test=> \l+
>        Name    |                Description
>     -----------+--------------------------------------------
>      postgres  | default administrative connection database
>      template0 | unmodifiable empty database
>      template1 | default template for new databases
> 
> -- 
>   Bruce Momjian  <bruce@momjian.us>        http://momjian.us
>   EnterpriseDB                             http://enterprisedb.com
> 
>   + It's impossible for everything to be true. +

[ text/x-diff is unsupported, treating like TEXT/PLAIN ]

> diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
> new file mode 100644
> index acd2514..b2da1cf
> *** a/src/bin/initdb/initdb.c
> --- b/src/bin/initdb/initdb.c
> *************** make_template0(void)
> *** 1976,1981 ****
> --- 1976,1983 ----
>           "REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n",
>           "REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n",
>   
> +         "COMMENT ON DATABASE template0 IS 'unmodifiable empty database';\n",
> + 
>           /*
>            * Finally vacuum to clean up dead rows in pg_database
>            */
> *************** make_postgres(void)
> *** 2011,2016 ****
> --- 2013,2019 ----
>       const char **line;
>       static const char *postgres_setup[] = {
>           "CREATE DATABASE postgres;\n",
> +         "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",
>           NULL
>       };
>   
> diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h
> new file mode 100644
> index 6419d65..ee4c858
> *** a/src/include/catalog/pg_database.h
> --- b/src/include/catalog/pg_database.h
> *************** typedef FormData_pg_database *Form_pg_da
> *** 71,77 ****
>   #define Anum_pg_database_datacl            12
>   
>   DATA(insert OID = 1 (  template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_));
> ! SHDESCR("default template database");
>   #define TemplateDbOid            1
>   
>   #endif   /* PG_DATABASE_H */
> --- 71,77 ----
>   #define Anum_pg_database_datacl            12
>   
>   DATA(insert OID = 1 (  template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 0 1663 _null_));
> ! SHDESCR("default template for new databases");
>   #define TemplateDbOid            1
>   
>   #endif   /* PG_DATABASE_H */

> 
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Thom Brown
Date:
On 15 March 2011 15:26, Bruce Momjian <bruce@momjian.us> wrote:
>
> Applied.  I did not bump the catalog version because they are just
> comments.  I assume that is the right procedure.

*SNIP*

>> +             "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",

Default administrative connection database?  Where's the "connection"
bit come from?

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: template0 database comment

From
Bruce Momjian
Date:
Thom Brown wrote:
> On 15 March 2011 15:26, Bruce Momjian <bruce@momjian.us> wrote:
> >
> > Applied. ?I did not bump the catalog version because they are just
> > comments. ?I assume that is the right procedure.
> 
> *SNIP*
> 
> >> + ? ? ? ? ? ? "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",
> 
> Default administrative connection database?  Where's the "connection"
> bit come from?

There was discussion that 'postgres' is the database that is used for
performing administrative connections, e.g. createdb.  Yeah, kind of
odd, but that's what it is used for.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


Re: template0 database comment

From
Thom Brown
Date:
On 15 March 2011 15:37, Bruce Momjian <bruce@momjian.us> wrote:
> Thom Brown wrote:
>> On 15 March 2011 15:26, Bruce Momjian <bruce@momjian.us> wrote:
>> >
>> > Applied. ?I did not bump the catalog version because they are just
>> > comments. ?I assume that is the right procedure.
>>
>> *SNIP*
>>
>> >> + ? ? ? ? ? ? "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",
>>
>> Default administrative connection database?  Where's the "connection"
>> bit come from?
>
> There was discussion that 'postgres' is the database that is used for
> performing administrative connections, e.g. createdb.  Yeah, kind of
> odd, but that's what it is used for.

Hmm... there's actually no mention of that in the docs for such tools:
http://www.postgresql.org/docs/9.0/static/app-createdb.html

There's also little mention of this "administrative" database in the
docs beyond saying it's merely a copy of template1 used as a default
database for users and applications to connect to.

I also notice there's no choice but to use the "postgres" database
with these tools.  Shouldn't we have an option that allows us to
specify an alternative database?

e.g.

createdb -d alternativedb newdb

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: template0 database comment

From
Thom Brown
Date:
On 15 March 2011 15:51, Thom Brown <thom@linux.com> wrote:
> On 15 March 2011 15:37, Bruce Momjian <bruce@momjian.us> wrote:
>> Thom Brown wrote:
>>> On 15 March 2011 15:26, Bruce Momjian <bruce@momjian.us> wrote:
>>> >
>>> > Applied. ?I did not bump the catalog version because they are just
>>> > comments. ?I assume that is the right procedure.
>>>
>>> *SNIP*
>>>
>>> >> + ? ? ? ? ? ? "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",
>>>
>>> Default administrative connection database?  Where's the "connection"
>>> bit come from?
>>
>> There was discussion that 'postgres' is the database that is used for
>> performing administrative connections, e.g. createdb.  Yeah, kind of
>> odd, but that's what it is used for.
>
> Hmm... there's actually no mention of that in the docs for such tools:
> http://www.postgresql.org/docs/9.0/static/app-createdb.html
>
> There's also little mention of this "administrative" database in the
> docs beyond saying it's merely a copy of template1 used as a default
> database for users and applications to connect to.
>
> I also notice there's no choice but to use the "postgres" database
> with these tools.  Shouldn't we have an option that allows us to
> specify an alternative database?
>
> e.g.
>
> createdb -d alternativedb newdb

And example patch attached.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment

Re: template0 database comment

From
David Fetter
Date:
On Sat, Mar 12, 2011 at 09:24:38PM +0000, Greg Stark wrote:
> On Sat, Mar 12, 2011 at 8:42 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> > A preposition is something you should try not to end a sentence
> > with.
> 
> Something to keep in mind when someone localises Postgres for Latin
> which has this rule.

Quidquid latine dictum sit, altum viditur. ;)

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


Re: template0 database comment

From
Bruce Momjian
Date:
Thom Brown wrote:
> On 15 March 2011 15:51, Thom Brown <thom@linux.com> wrote:
> > On 15 March 2011 15:37, Bruce Momjian <bruce@momjian.us> wrote:
> >> Thom Brown wrote:
> >>> On 15 March 2011 15:26, Bruce Momjian <bruce@momjian.us> wrote:
> >>> >
> >>> > Applied. ?I did not bump the catalog version because they are just
> >>> > comments. ?I assume that is the right procedure.
> >>>
> >>> *SNIP*
> >>>
> >>> >> + ? ? ? ? ? ? "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n",
> >>>
> >>> Default administrative connection database? ?Where's the "connection"
> >>> bit come from?
> >>
> >> There was discussion that 'postgres' is the database that is used for
> >> performing administrative connections, e.g. createdb. ?Yeah, kind of
> >> odd, but that's what it is used for.
> >
> > Hmm... there's actually no mention of that in the docs for such tools:
> > http://www.postgresql.org/docs/9.0/static/app-createdb.html
> >
> > There's also little mention of this "administrative" database in the
> > docs beyond saying it's merely a copy of template1 used as a default
> > database for users and applications to connect to.
> >
> > I also notice there's no choice but to use the "postgres" database
> > with these tools. ?Shouldn't we have an option that allows us to
> > specify an alternative database?
> >
> > e.g.
> >
> > createdb -d alternativedb newdb
> 
> And example patch attached.

We have actually never gotten a request for this so it is hard to see
why we would add it.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +