Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9JbT-00059c-2w for pgsql-docs@arkaria.postgresql.org; Tue, 22 Nov 2016 22:31:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c9JbS-0002oN-2n for pgsql-docs@arkaria.postgresql.org; Tue, 22 Nov 2016 22:31:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c9JbQ-0002ns-Ss for pgsql-docs@postgresql.org; Tue, 22 Nov 2016 22:31:49 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1c9JbN-0000p7-MH for pgsql-docs@postgresql.org; Tue, 22 Nov 2016 22:31:47 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1c9JbM-0006aF-KM; Tue, 22 Nov 2016 17:31:44 -0500 Date: Tue, 22 Nov 2016 17:31:44 -0500 From: Bruce Momjian To: Jason O'Donnell Cc: pgsql-docs@postgresql.org Subject: Re: Example error in createdb doc Message-ID: <20161122223144.GA31341@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 > LATIN1 encoding scheme with a look at the > underlying command: > > -$ createdb -p 5000 -h eden -E LATIN1 -e demo > -CREATE DATABASE demo ENCODING 'LATIN1'; > +$ createdb -p 5000 -h eden -E LATIN1 -T template0 -e demo > +CREATE DATABASE demo ENCODING 'LATIN1' TEMPLATE template0; > > 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 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 + --8t9RHnE3ZwKMSgU+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="createdb.diff" diff --git a/doc/src/sgml/ref/createdb.sgml b/doc/src/sgml/ref/createdb.sgml new file mode 100644 index c363bd4..0cad708 *** a/doc/src/sgml/ref/createdb.sgml --- b/doc/src/sgml/ref/createdb.sgml *************** PostgreSQL documentation *** 362,373 **** To create the database demo using the ! server on host eden, port 5000, using the ! LATIN1 encoding scheme with a look at the ! underlying command: ! $ createdb -p 5000 -h eden -E LATIN1 -e demo ! CREATE DATABASE demo ENCODING 'LATIN1'; --- 362,372 ---- To create the database demo using the ! server on host eden, port 5000, here is the command-line ! command and the underlying SQL command: ! $ createdb -p 5000 -h eden -e demo ! CREATE DATABASE demo; --8t9RHnE3ZwKMSgU+ Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --8t9RHnE3ZwKMSgU+--