Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cq8XT-0000TL-BE for pgsql-docs@arkaria.postgresql.org; Tue, 21 Mar 2017 01:24:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cq8XS-0002nm-Ug for pgsql-docs@arkaria.postgresql.org; Tue, 21 Mar 2017 01:24:42 +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 1cq8X5-0001jz-75 for pgsql-docs@postgresql.org; Tue, 21 Mar 2017 01:24:19 +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 1cq8X2-0008PC-Fg for pgsql-docs@postgresql.org; Tue, 21 Mar 2017 01:24:18 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1cq8X0-0008Gi-P6; Mon, 20 Mar 2017 21:24:14 -0400 Date: Mon, 20 Mar 2017 21:24:14 -0400 From: Bruce Momjian To: Tom Lane Cc: Jason O'Donnell , pgsql-docs@postgresql.org Subject: Re: Example error in createdb doc Message-ID: <20170321012414.GA2045@momjian.us> References: <20161122223144.GA31341@momjian.us> <16840.1479856655@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline In-Reply-To: <16840.1479856655@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.9 (-) 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=us-ascii Content-Disposition: inline On Tue, Nov 22, 2016 at 06:17:35PM -0500, Tom Lane wrote: > Bruce Momjian writes: > > On Thu, Oct 27, 2016 at 09:01:59PM -0400, Jason O'Donnell wrote: > >> The example given for createdb fails because template0 is not provided: > > > 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. > > I dunno. The use of -e seems pretty pointless for a call that is going to > yield a trivial CREATE DATABASE command. Besides, we already showed a > minimal example. If you think Jason's example is too complex, what about > just subbing in "-T template0" for "-E LATIN1"? That should work > regardless of other configuration. [Just getting back to this November email] Agreed on using -T. > Also, your change to the text loses the point that -e provokes printing > the underlying command. Admittedly, that was somewhat indirect in the way > it was phrased before, but now the concept is just gone entirely; that > doesn't feel like an improvement either. > > Personally I thought Jason's patch was fine as-is. I tried Jason's example on my server and got an error, so I don't want to trade one error example for another: $ createdb -p 5432 -h localhost -E LATIN1 -T template0 -e demo CREATE DATABASE demo ENCODING 'LATIN1' TEMPLATE template0; createdb: database creation failed: ERROR: encoding "LATIN1" does not match locale "en_US.UTF-8" DETAIL: The chosen LC_CTYPE setting requires encoding "UTF8". I went with the template0 example, attached, and applied it to head. -- 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..9fc4c16 *** a/doc/src/sgml/ref/createdb.sgml --- b/doc/src/sgml/ref/createdb.sgml *************** PostgreSQL documentation *** 363,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'; --- 363,373 ---- To create the database demo using the server on host eden, port 5000, using the ! template0 template database, here is the ! command-line command and the underlying SQL command: ! $ createdb -p 5000 -h eden -T template0 -e demo ! CREATE DATABASE demo TEMPLATE template0; --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+--