Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olX4K-0007jf-Sk for pgsql-general@arkaria.postgresql.org; Thu, 20 Oct 2022 15:02:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1olX4I-0002vt-Li for pgsql-general@arkaria.postgresql.org; Thu, 20 Oct 2022 15:02:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olX4H-0002vj-Fd for pgsql-general@lists.postgresql.org; Thu, 20 Oct 2022 15:02:46 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olX4D-0001LC-Qa for pgsql-general@lists.postgresql.org; Thu, 20 Oct 2022 15:02:44 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0814C5C00A9; Thu, 20 Oct 2022 11:02:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 20 Oct 2022 11:02:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1666278159; x= 1666364559; bh=zHLj9RFaN9Vbu880GVpUeZRlMA+gAtQijnjZvVJiNJo=; b=L HPDenzY1xbd7as4PgIzp1SZoiWuONJFNgKy5dY+kdd+CL2XSM7+lH+E0NXJQI3e4 mxTyPHOnEwQJO3qUeiPuduCqNIZ9gE6IRB+lgwSiTTMJepBkE9HEBJINYRxZ7xWD 0Tq5E/2/5z1Yl9B8KPLYSkCzYNLGqWXnaA5qE19+YSDQQWsflGxyOHyHjEF813us DNEL7D7U5Oj52UAIiFweRcvysQ3fag3T2BwHMdjCT/HHogHZmHPoEzkTPFpI6Vbc M4Z8lyubVL+uFq3DlRGqijQLVop3sHrK5THgI0GDkRBiOyMDWfwSaMejuzDhRuBY wWleDD0Ncu1fD1q7UN+0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1666278159; x=1666364559; bh=z HLj9RFaN9Vbu880GVpUeZRlMA+gAtQijnjZvVJiNJo=; b=L7rnebsMick0l827S 5Kj1Tt6UpRByqmeCWsaXf4vPFthK0+OusIiyuGeXKQL3UujnYyfG8axcnrJJTgxb SSUcPepchLuvLZU8vurKoUlHthNb59X5NUHpgxv+sSiTEsFKDIXiPmTfLfKOHZSj aHP+EiNqZayOjuss5U03pq4fweLef0Fm6lJxvRbSPLp+9e/+DSBVApMbCzIVYD9l 9AbRuI22Q2MwXOZQKHWtTYMgl/rPb0AxH0XbqW6cfEZy0bdv6S825bKAJpK7qlhw DCU6kve+nsLpJdMhmiZEWMN9O66PbxNV7//2Jcjy0hqFEg/aNQq7I0bbLvHu8MuG SAS9w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeliedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepvedvkeeihf duhffhtdekleegffduiefgteejgeffgffhteefleeludfgleelgeevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 20 Oct 2022 11:02:37 -0400 (EDT) Message-ID: Date: Thu, 20 Oct 2022 08:02:37 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: pg_restore 12 "permission denied for schema" errors To: Ron , pgsql-general@lists.postgresql.org References: <287717df-88e2-a4a5-2025-260c39662bca@gmail.com> <40fd91d2-d981-2f44-4d58-a3f08a9448fb@familie-gard.de> <2980993.1666242738@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/20/22 06:20, Ron wrote: > On 10/20/22 00:12, Tom Lane wrote: >> Frank Gard writes: >>> Am 20.10.22 um 02:58 schrieb Ron: >>>> pg_restore -v --create --clean --jobs=`nproc` -Fd --dbname=template1 >>>> $DB >>> What database do you want to restore your data into? As far as I know >>> your pg_restore command would import the data into template1, right? >> No --- my ears went up about that too, but he's using --create. >> So template1 is just the springboard for the initial connection >> in which CREATE DATABASE will be issued. >> >> My guess is that there's something inconsistent between source >> and target installations about roles and role-privilege grants. >> We don't have enough details to do more than guess, though. > > I ran "pg_dumpall --globals-only --no-role-passwords" on the source > instance, and applied it to the new instance before doing the > pg_restore. If I hadn't done that, pg_restore would have thrown errors > on all the GRANT and ALTER TABLE ... OWNER TO statements embedded in the > backup. > Some questions: 1) The backup was from a Postgres 12.x database using a version 12 or higher instance of pg_backup? 2) What does nproc --jobs=`nproc` resolve to? 3) What if you run without --jobs? 4) What user are you running the pg_restore as? 5) Why the --no-role-passwords in the pg_dump? -- Adrian Klaver adrian.klaver@aklaver.com