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 1tp82y-000pgi-Dj for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Mar 2025 15:49:36 +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 1tp82w-00AWZj-Qn for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Mar 2025 15:49:34 +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 1tp82w-00AWZ7-HK for pgsql-hackers@lists.postgresql.org; Mon, 03 Mar 2025 15:49:34 +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 1tp82u-000jue-0u for pgsql-hackers@lists.postgresql.org; Mon, 03 Mar 2025 15:49:33 +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 523FnUFQ3660952; Mon, 3 Mar 2025 10:49:30 -0500 From: Tom Lane To: Ashutosh Bapat cc: Etsuro Fujita , PostgreSQL Hackers Subject: =?UTF-8?Q?Re:_Options_to_control_remote_transactions=E2=80=99_acc?= =?UTF-8?Q?ess/deferrable_modes_in_postgres=5Ffdw?= In-reply-to: References: Comments: In-reply-to Ashutosh Bapat message dated "Mon, 03 Mar 2025 18:21:15 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3660950.1741016970.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 03 Mar 2025 10:49:30 -0500 Message-ID: <3660951.1741016970@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ashutosh Bapat writes: > On Sun, Mar 2, 2025 at 5:14=E2=80=AFPM Etsuro Fujita wrote: >> To avoid that, I would like to propose a server option, >> inherit_read_only, to open the remote transactions in read-only mode >> if the local transaction is read-only. > Why do we need a server option. Either we say that a local READ ONLY > transaction causing modifications on the foreign server is problematic > or it's expected. But what's the point in giving that choice to the > user? If we deem the behaviour problematic it should be considered as > a bug and we should fix it. Otherwise not fix it. I tend to agree with Ashutosh's position here. Reasoning about issues like this is hard enough already. Having to figure out an application's behavior under more than one setting makes it harder. You may argue that "then the application can choose the behavior it likes, so there's no need to figure out both behaviors". But for a lot of bits of code, that's not the situation; rather, they have to be prepared to work under both settings, because someone else is in charge of what the setting is. (I don't know if either of you recall our disastrous attempt at server-side autocommit, back around 7.3. The reason that got reverted was exactly that there was too much code that had to be prepared to work under either setting, and it was too hard to make that happen. So now I look with great suspicion at anything that complicates our transactional behavior.) >> I would also like to propose a server option, inherit_deferrable, to >> open the remote transactions in deferrable mode if the local >> transaction is deferrable. > The documentation about deferrable is quite confusing. It says "The > DEFERRABLE transaction property has no effect unless the transaction > is also SERIALIZABLE and READ ONLY." But it doesn't tell what's the > effect of deferrable transaction. But probably we don't need a server > option here as well. Yeah, same with this: we should either change it or not. Multiple possible transactional behaviors don't do anyone any favors. regards, tom lane