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 1uQShC-00BRxg-9L for pgsql-general@arkaria.postgresql.org; Sat, 14 Jun 2025 15:21:26 +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 1uQShA-0093t2-BE for pgsql-general@arkaria.postgresql.org; Sat, 14 Jun 2025 15:21:24 +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 1uQSh9-0093su-GI for pgsql-general@lists.postgresql.org; Sat, 14 Jun 2025 15:21:24 +0000 Received: from fhigh-b4-smtp.messagingengine.com ([202.12.124.155]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uQSh7-001ybl-2k for pgsql-general@lists.postgresql.org; Sat, 14 Jun 2025 15:21:23 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 419E82540080; Sat, 14 Jun 2025 11:21:21 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sat, 14 Jun 2025 11:21:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1749914481; x=1750000881; bh=peaBNfZb9iHsHqwFTQqe+yHmXb3nt8w7teD4RRQL4T8=; b= RY1Sz+i6DdcEQJHeL6gAsNbmB/igj0RqnDg5CibFt7LMfjOt805+4F6KESVCJiIT XQ4wmz3lP4P5Wi1/BY9vbi4P2TxtkVbRhWraPJ/nw+8vHWeo+f0Pz3IhsptWT8Ze +5MHo3e2Ttw+2DxrlYN+AqogaI0aluYKXNW9Lc4v9AFWvtcXI3UZxYHiEFb0yDjX qLRPB4S1VkJ1vx+Fo6a1POE/PbzvDdfdGELUXMDLC115tMtXaKafA1Mclk6hPIUx 0q8ecTombz53EMFWvVwaEwYZHnbQqvBmnF2te5yAS2ivi4T5POCTyunb/aqElSEq rmmF03ylg7whQPwZNZDB9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749914481; x= 1750000881; bh=peaBNfZb9iHsHqwFTQqe+yHmXb3nt8w7teD4RRQL4T8=; b=m RPpmXJLT8ghy8anWvFkLB+GN6fq6ezH4W64E9kCUeF0iVKOOglne8L0dZ9ehEDqh hJ2rwgHDMpS5pygS/LgVrQU8NFXVU/u0tiCcv9oFuuyQfcCaTcYjjg/EAtYgZeMH in1dh4zU6r8WAePsuXeC9PNAaO8tE9JFKtXqln1Nn9wsPJCwhJV6pYLHbpFHsRIp ekvyjdt7m4+G4piPmNTTBZ2zkGzWNU6CASJIalwj7qG/sw7G+WG6nbL/RXLfQC05 nqoOuvHAGxwpKBaR0biX5jnf7IDq5T/or7GTV5TcKI8cPFbYQp9OT4vGlaIEEeta tAh+VQo2I7WjVdIofJ0iA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvuddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddv jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpefgudefkefhveefleev ieeuveehvdduudekuddvvdelhfeuueeijedtuedvvedvueenucffohhmrghinhepphhosh htghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnh gspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprhhrohgt hhesthhuthgrnhhothgrrdguvgdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprg druhhspdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshht ghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 14 Jun 2025 11:21:20 -0400 (EDT) Message-ID: Date: Sat, 14 Jun 2025 08:21:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_restore ERROR: permission denied to change default privileges To: Rachel Roch Cc: Tom Lane , Pgsql General References: <1407215.1749838987@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: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/14/25 01:42, Rachel Roch wrote: > > > > 13 Jun 2025, 20:13 by adrian.klaver@aklaver.com: > >> >> To get at an editable script you can do something like: >> >> pg_restore -f my_database_txt.sql my_database.dump >> >> This will give you a plain text version of the dump that you can feed back to psql to load into remote database. >> > > Thanks Adrian ! > > I had thought maybe maybe I could do a "pg_restore -l my_database.dump" and ignore the relevant line using whatever the other flag is, but sadly there doesn't appear to be enough flexibility, i.e. > > pg_restore -l my_database.dump | fgrep -F postgres > gives: > 2067; 826 16607 DEFAULT ACL public DEFAULT PRIVILEGES FOR TABLES postgres > > But > > pg_restore -l my_database.dump | fgrep -F my_database_ro > gives nothing.   :( That is because the lines returned from pg_restore -l are not the full commands, they represent(generally) a summary of the object, its name and the owner. The error message and your first example above show that the command is there. See at here: https://www.postgresql.org/docs/current/app-pgrestore.html in the Examples section how you can comment out the line. Then you could use -L to feed the list back to pg_restore. Isn't fgrep -F redundant? As I understand it fgrep = grep -F > > So either your solution or Tom's "just ignore it" sound like they'll work. -- Adrian Klaver adrian.klaver@aklaver.com