[GENERAL] Create database from template and include comment - Mailing list pgsql-general

From Peter Devoy
Subject [GENERAL] Create database from template and include comment
Date
Msg-id CABoFc_gt+LqTr+wf-yBgfgZ+gT4+d6SmoJRkOJdFK=szt_OY4A@mail.gmail.com
Whole thread Raw
List pgsql-general
Hi all

If when creating a database I use another user-defined database as a template I would like the option for the comment on the template database to also exist for the new database.  Am I correct in thinking there is no feature for this, perhaps because the global nature of pg_shdescription?

For an example of the default behavior:

CREATE DATABASE test_comment_template;
COMMENT ON DATABASE test_comment_template IS 'hello world';

CREATE DATABASE test_comment WITH TEMPLATE test_comment_template;

SELECT oid, datname, shobj_description(oid, 'pg_database')
FROM   pg_database
WHERE  datname LIKE 'test_comment%';

  oid   |        datname        | shobj_description
--------+-----------------------+-------------------
 828611 | test_comment_template | hello world
 828612 | test_comment          |


DROP DATABASE test_comment;
DROP DATABASE test_comment_template;

Kind regards


Peter

pgsql-general by date:

Previous
From: Martin Moore
Date:
Subject: Re: [GENERAL] Postgres 9.6 fails to start on VMWare
Next
From: Don Seiler
Date:
Subject: Re: [GENERAL] Allow only certain query on replication slave