Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSSz7-0001PL-RQ for pgsql-general@arkaria.postgresql.org; Wed, 06 Nov 2019 21:37:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iSSz5-0000MZ-Rg for pgsql-general@arkaria.postgresql.org; Wed, 06 Nov 2019 21:36:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSSz5-0000MS-F3 for pgsql-general@lists.postgresql.org; Wed, 06 Nov 2019 21:36:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iSSz2-0003Kw-US for pgsql-general@postgresql.org; Wed, 06 Nov 2019 21:36:58 +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 xA6LaS1x024622; Wed, 6 Nov 2019 16:36:28 -0500 From: Tom Lane To: Peter cc: pgsql-general@postgresql.org Subject: Re: Locked out of schema public (pg_dump lacks backup of the grant) In-reply-to: <20191106204925.GA17842@gate.oper.dinoex.org> References: <20191106204925.GA17842@gate.oper.dinoex.org> Comments: In-reply-to Peter message dated "Wed, 06 Nov 2019 21:49:25 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24620.1573076188.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 06 Nov 2019 16:36:28 -0500 Message-ID: <24621.1573076188@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter writes: > If you do only "pg_restore -c -d ", the sessions can stay open, > but then it will do > DROP SCHEMA public; > CREATE SCHEMA public; > and it will NOT restore the grant because it is not in the backup. We improved that situation in v11, I believe. What I see for this case these days is per commit 5955d9341: Also, change the very ad-hoc mechanism that was used to avoid dumping creation and comment commands for the public schema. Instead of hardw= iring a test in _printTocEntry(), make use of the DUMP_COMPONENT_ infrastruc= ture to mark that schema up-front about what we want to do with it. This h= as the visible effect that the public schema won't be mentioned in the ou= tput at all, except for updating its ACL if it has a non-default ACL. Previously, while it was normally not mentioned, --clean mode would dr= op and recreate it, again causing headaches for non-superuser usage. Thi= s change likewise makes the public schema less special and more like oth= er built-in objects. regards, tom lane