Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edi4E-0002wY-Im for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jan 2018 19:47:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edi4D-000573-I6 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jan 2018 19:47:41 +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 1edi4D-00056t-8B for pgsql-hackers@lists.postgresql.org; Mon, 22 Jan 2018 19:47:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1edi4A-0007nm-Qf for pgsql-hackers@postgresql.org; Mon, 22 Jan 2018 19:47:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0MJlagM008043; Mon, 22 Jan 2018 14:47:36 -0500 From: Tom Lane To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: pgsql: Move handling of database properties from pg_dumpall into pg_dum In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Mon, 22 Jan 2018 14:26:06 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8041.1516650456.1@sss.pgh.pa.us> Date: Mon, 22 Jan 2018 14:47:36 -0500 Message-ID: <8042.1516650456@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Mon, Jan 22, 2018 at 2:09 PM, Tom Lane wrote: >> pg_dumpall with --clean will now drop and recreate the "postgres" and >> "template1" databases in the target cluster, allowing their locale and >> encoding settings to be changed if necessary, and providing a cleaner >> way to set nondefault tablespaces for them than we had before. This >> means that such a script must now always be started in the "postgres" >> database; the order of drops and reconnects will not work otherwise. >> Without --clean, the script will not adjust any database-level properties >> of those two databases (including their comments, ACLs, and security >> labels, which it formerly would try to set). > Unless we insert some guard that causes a hard error or at least warns > the user if they do the wrong thing, this seems extremely likely to > have people (1) try to dump and restore using pg_dumpall and (2) > complain when it doesn't work. Actually, it'll work fine if your OS > username happens to be "postgres", but otherwise not so much. Not entirely following your concern. The initial DB's name is "postgres" regardless of the bootstrap superuser's name. If you're thinking of the case where you do "initdb -U joe" and then try to "psql