Re: Example error in createdb doc

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Jason O'Donnell <odonnelljp01(at)gmail(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Example error in createdb doc
Date: 2016-11-22 22:31:44
Message-ID: 20161122223144.GA31341@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, Oct 27, 2016 at 09:01:59PM -0400, Jason O'Donnell wrote:
> Hello,
>
> I believe I've found an incorrect example in the createdb documentation:
> https://www.postgresql.org/docs/current/static/app-createdb.html
>
> The example given for createdb fails because template0 is not provided:
>
> [~] createdb -p 5000 -h eden -E LATIN1 -e demo
> CREATE DATABASE demo ENCODING 'LATIN1';
> createdb: database creation failed: ERROR:  new encoding (LATIN1) is
> incompatible with the encoding of the template database (SQL_ASCII)
> HINT:  Use the same encoding as in the template database, or use template0 as
> template.
>
> I've attached a patch that addresses the issue.
...
> diff --git a/doc/src/sgml/ref/createdb.sgml b/doc/src/sgml/ref/createdb.sgml
> index c363bd4..bd1de1f2f 100644
> --- a/doc/src/sgml/ref/createdb.sgml
> +++ b/doc/src/sgml/ref/createdb.sgml
> @@ -366,8 +366,8 @@ PostgreSQL documentation
> <literal>LATIN1</literal> encoding scheme with a look at the
> underlying command:
> <screen>
> -<prompt>$ </prompt><userinput>createdb -p 5000 -h eden -E LATIN1 -e demo</userinput>
> -<computeroutput>CREATE DATABASE demo ENCODING 'LATIN1';</computeroutput>
> +<prompt>$ </prompt><userinput>createdb -p 5000 -h eden -E LATIN1 -T template0 -e demo</userinput>
> +<computeroutput>CREATE DATABASE demo ENCODING 'LATIN1' TEMPLATE template0;</computeroutput>
> </screen></para>
> </refsect1>

I have looked over this report and patch, and it just doesn't feel
right. The example is intending to show how to use common psql-like
options to control createdb. Adding the encoding is nice, but then
having to switch to template0 so the encoding setting works just seems
beyond the scope of what we want do there.

I think the attached patch is more focused.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
createdb.diff text/x-diff 1.1 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2016-11-22 23:17:35 Re: Example error in createdb doc
Previous Message Tom Lane 2016-11-22 18:47:31 Re: [HACKERS] switching documentation build to XSLT