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 1lv3qI-0005VQ-OF for pgsql-general@arkaria.postgresql.org; Sun, 20 Jun 2021 20:14:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lv3pk-0002f0-U7 for pgsql-general@arkaria.postgresql.org; Sun, 20 Jun 2021 20:14:20 +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 1lv3pj-0002eq-G1 for pgsql-general@lists.postgresql.org; Sun, 20 Jun 2021 20:14:20 +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 1lv3pc-000226-0l for pgsql-general@lists.postgresql.org; Sun, 20 Jun 2021 20:14:18 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id F148D5C011C; Sun, 20 Jun 2021 16:14:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 20 Jun 2021 16:14:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=a vuYG+J3DNy3/NlDRUD3PlWlAn1TLo03klVgCOOpAzg=; b=oyYbQZLEGI6XTbXuf Svi4ihSi/rVgBZwM0MuKrp2+vp8saune2seozLi3lca0+xQCIscSAceLeWfXIYQS oe9jKXopNYPJUXKmLEw402QYMcc7ASIpLpMQYDNiVY/C7oaj9XMyHHx4592WGJEc JUrej05Cog4m7nWw2OI+pvSlCs8hrp5lrHfLPH6FgUdOJsmglz8+Kf3sYQfVnzWg eYUv6WFm9sO9pRrOZa82L/wTjkeD0kH2NkOaMUWR0A21DY+eiifHkNGKSLe8KNlO epaVCdtNTqw0Xel6tiC3TzEC0ps0oyadfIGqsitAr8udh3CX2ghdvJElEUW2Qmuj OtGKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=avuYG+J3DNy3/NlDRUD3PlWlAn1TLo03klVgCOOpA zg=; b=oHtg7fZlZTiDhSd69wxTPBZ9BKzpZq1TxuV4AqUf1MXmpfytJMKNeknG6 Aqv8RpP97Ayaw3z+0ZDwkPAHceQLX7jSbBZQ+E9rdLElZ9qLnlgUnf2hPrjRoyuZ xsY3AbrBVczeQhi7roIyutttykRRhuYdAWU82b8LBkLISptJZsQPOfbD2YysY/bR Ii1OMyhhR290AUUjwTfuzJbmVaau3tni7Ib2zYSI7vSdTr4e1KoLDlvsakzxbw/8 WmdwEk7bit+d87O5ekIitQKru3obSEbyg/4dO8XL6cWBi9o2Pqyu8DBTkOMzI+KR 2IwGy6fDQZbpl7JJK80xEwM2m8hFQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeefjedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepteejvdetffejuedvleeifeefheeutdfhgfdvhffh hfekvdduveegvdejudefgfevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 20 Jun 2021 16:14:07 -0400 (EDT) Subject: Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2 To: Karsten Hilbert , Tom Lane Cc: pgsql-general@lists.postgresql.org References: <1511776.1624211267@sss.pgh.pa.us> From: Adrian Klaver Message-ID: <3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com> Date: Sun, 20 Jun 2021 13:14:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/20/21 12:34 PM, Karsten Hilbert wrote: > Am Sun, Jun 20, 2021 at 01:47:47PM -0400 schrieb Tom Lane: > >> Hence, the only way to make this scenario work would be for the >> restore script to explicitly override default_transaction_read_only. > [...] >> Also, doing so would result in ignoring default_transaction_read_only >> no matter what the source of that was. I think it's probably not >> hard to construct scenarios where someone would really not be happy >> about such behavior. > > Any chance pg_dump (and/or pg_restore) might gain an option > --ignore-read-only ? That way, PostgreSQL need not decide > for users. How about: 1) pg_dump -Fc -d read_only_db -U postgres -f read_only.out 2) In new cluster: A) psql -d postgres -U postgres CREATE DATABASE read_only; B) pg_restore -d read_only -U postgres read_only.out C) psql -d read_only -U postgres alter database read_only SET default_transaction_read_only TO 'on'; > > Thanks, > Karsten > -- > GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B > > -- Adrian Klaver adrian.klaver@aklaver.com