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 1lv1Y7-0001Ip-1m for pgsql-general@arkaria.postgresql.org; Sun, 20 Jun 2021 17:47:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lv1Y6-000644-0O for pgsql-general@arkaria.postgresql.org; Sun, 20 Jun 2021 17:47:58 +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 1lv1Y5-00063w-Nn for pgsql-general@lists.postgresql.org; Sun, 20 Jun 2021 17:47:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lv1Xz-0000wM-Mp for pgsql-general@lists.postgresql.org; Sun, 20 Jun 2021 17:47:57 +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 15KHllGF1511777; Sun, 20 Jun 2021 13:47:47 -0400 From: Tom Lane To: Karsten Hilbert cc: pgsql-general@lists.postgresql.org Subject: Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2 In-reply-to: References: Comments: In-reply-to Karsten Hilbert message dated "Sun, 20 Jun 2021 18:47:36 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1511775.1624211267.1@sss.pgh.pa.us> Date: Sun, 20 Jun 2021 13:47:47 -0400 Message-ID: <1511776.1624211267@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Karsten Hilbert writes: > I am testing the pg_restore of a database with > default_transaction_read_only=on. Hm. It's intentional that we reconnect after applying the database properties, so that they are in effect during the restore. It seems likely that failing to do so could result in misbehaviors. Hence, the only way to make this scenario work would be for the restore script to explicitly override default_transaction_read_only. That seems like a darn bad idea, really. If pg_dump thinks it's authorized to ignore that, why shouldn't every other application? 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. In short, I'm inclined to say "don't do that". Maybe it'd be a better idea to apply default_transaction_read_only to particular roles (and not run pg_restore under such a role). regards, tom lane