Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQ93Y-005cQb-Rz for pgsql-general@arkaria.postgresql.org; Fri, 13 Jun 2025 18:23:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uQ93W-004myG-2n for pgsql-general@arkaria.postgresql.org; Fri, 13 Jun 2025 18:23:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQ93V-004my8-No for pgsql-general@lists.postgresql.org; Fri, 13 Jun 2025 18:23:10 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uQ93U-001pNx-1h for pgsql-general@lists.postgresql.org; Fri, 13 Jun 2025 18:23:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 55DIN7JD1407216; Fri, 13 Jun 2025 14:23:07 -0400 From: Tom Lane To: Rachel Roch cc: Pgsql General Subject: Re: pg_restore ERROR: permission denied to change default privileges In-reply-to: References: Comments: In-reply-to Rachel Roch message dated "Fri, 13 Jun 2025 20:08:11 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1407214.1749838987.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 13 Jun 2025 14:23:07 -0400 Message-ID: <1407215.1749838987@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Rachel Roch writes: > This is the error I am seeing: > pg_restore: error: could not execute query: ERROR: permission denied to= change default privilegesCommand was: ALTER DEFAULT PRIVILEGES FOR ROLE "= postgres" IN SCHEMA "public" GRANT SELECT ON TABLES TO "my_database_ro"; Well, you aren't going to be able to do that if you're not superuser. You could undo that ALTER in the source database and re-make the dump, or edit the dump script to remove this command, or not use pg_restore's "-1" switch and just ignore this error. regards, tom lane