Re: template0 database comment - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: template0 database comment
Date
Msg-id 201103151526.p2FFQuq23698@momjian.us
Whole thread Raw
In response to Re: template0 database comment  (Bruce Momjian <bruce@momjian.us>)
Responses Re: template0 database comment
List pgsql-hackers
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. +


pgsql-hackers by date:

Previous
From: Mike Fowler
Date:
Subject: Re: new keywords in 9.1
Next
From: Thom Brown
Date:
Subject: Re: template0 database comment