Re: template0 database comment - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: template0 database comment
Date
Msg-id 201103141518.p2EFIXh08673@momjian.us
Whole thread Raw
In response to Re: template0 database comment  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
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
      };


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Macros for time magic values
Next
From: Dave Page
Date:
Subject: Re: GSoC 2011 - Mentors? Projects?