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 1uQ9q6-005ptG-QT for pgsql-general@arkaria.postgresql.org; Fri, 13 Jun 2025 19:13:22 +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 1uQ9q3-004wKi-OT for pgsql-general@arkaria.postgresql.org; Fri, 13 Jun 2025 19:13:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQ9q2-004wKZ-Om for pgsql-general@lists.postgresql.org; Fri, 13 Jun 2025 19:13:20 +0000 Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uQ9q0-001tFy-06 for pgsql-general@lists.postgresql.org; Fri, 13 Jun 2025 19:13:18 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 16C1425401A0; Fri, 13 Jun 2025 15:13:13 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Fri, 13 Jun 2025 15:13:13 -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=1749841991; x=1749928391; bh=7/VFMLC+nMrCs3/n5yXi9+L+Kcr55qT0aGQWPbcZG0M=; b= lEcxqqjv+euV8j3T4tsQ41ZI91wyWMNG3ByO8IADEMygvjxYehGWgbbYqGxZk7/d nq3GzXnKW84SNykjyIYGHJBuBgjasG8v9ydK+QpZo8MiqYG+B2VBqf47geWmjVq9 iIOpr6Ov4uaYlveLhkRyVIOJe3R35JP0Eo49yiZVrTWDlPBluRrAjigx8S5njGTt hsvNTssRNRBbZak1WWmO04xmSlMpgW8uPz+xowcq+WApTpE+nQYs5Yqt7/KDTYIm 4QVQd8/tQXDWl8QtvCX5LRxGjAD+G3YavTXwGufTFl3c/F8eyiLXMjm3yFRlkap/ LRnI7FUJwqKe+9iybriwvg== 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=1749841991; x= 1749928391; bh=7/VFMLC+nMrCs3/n5yXi9+L+Kcr55qT0aGQWPbcZG0M=; b=J S7skh2Xn7aZ/X+bomMEOG7NyAQoDPH9ahtnK7l04nT1EKBAblsQH+sgoWhj2XO5l vs1gqxfE1AqyJHYYBNPIwLoAe3oO2wFj4NSKlgodvuHWjhATZVL7homcmtOnR6Lc fPTSPibScKWrEmqy71MGg4PNDroXMDZCKP3ZVZy/7tGiM30iOTNimTo4roQcir4R +sY18AfNMbdI9HbNMN2OnOAJ7n5fxni51zrEnITqSHp5Ee7eFVIX5j446EmPdNgI HXBVyj19+WZcxAfjd6Epbz99/MCfSDiVtPHbZ//kyQPqS79FbhjZIjTS7lMZeHf2 +Ih0HvwrYqf10kO0Zal4A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddukeejiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpefhveeihfevlefffedt hedukeevfefhfedtgeeifeevteffgfefhedtffetudettdenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegr khhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuth dprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprgdruhhspdhrtghpthhtoheprhhr ohgthhesthhuthgrnhhothgrrdguvgdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrg hlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 13 Jun 2025 15:13:10 -0400 (EDT) Message-ID: Date: Fri, 13 Jun 2025 12:13:09 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_restore ERROR: permission denied to change default privileges To: Tom Lane , Rachel Roch Cc: Pgsql General References: <1407215.1749838987@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: <1407215.1749838987@sss.pgh.pa.us> 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 6/13/25 11:23, Tom Lane wrote: > 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 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. If you want to do this in steps you can do: pg_restore -s-f my_database_sch_txt.sql my_database.dump to get the object(schema) definitions only and then pg_restore -a -f my_database_data_txt.sql my_database.dump to get the data definitions. > pg_restore's "-1" switch and just ignore this error. > > regards, tom lane > > -- Adrian Klaver adrian.klaver@aklaver.com