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 1oGMcb-00084R-0G for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Jul 2022 15:37:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oGMcY-0003Ms-VX for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Jul 2022 15:37:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGMcY-0003Mj-Mh for pgsql-bugs@lists.postgresql.org; Tue, 26 Jul 2022 15:37:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oGMcW-0007KQ-Gi for pgsql-bugs@lists.postgresql.org; Tue, 26 Jul 2022 15:37:17 +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 26QFbEx12356217; Tue, 26 Jul 2022 11:37:14 -0400 From: Tom Lane To: "David G. Johnston" cc: Bruce Momjian , Yugo Nagata , PostgreSQL mailing lists Subject: Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands In-reply-to: References: <17434-d9f7a064ce2a88a3@postgresql.org> <3190751.1657845414@sss.pgh.pa.us> <3498921.1657919211@sss.pgh.pa.us> <805866.1658175624@sss.pgh.pa.us> <2350990.1658848101@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Tue, 26 Jul 2022 08:22:38 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2356215.1658849834.1@sss.pgh.pa.us> Date: Tue, 26 Jul 2022 11:37:14 -0400 Message-ID: <2356216.1658849834@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > Thanks! This added section is clear and now affirms the understanding I've > come to with this thread, mostly. I'm still of the opinion that the > definition of "cannot be executed inside a transaction block" means that we > must "auto-sync" (implicit commit) before and after the restricted command, > not just after, and that the new section should cover this - whether we do > or do not - explicitly. I'm not excited about your proposal to auto-commit before starting the command. In the first place, we can't: we do not know whether the command will call PreventInTransactionBlock. Restructuring to change that seems untenable in view of past cowboy decisions about use of PreventInTransactionBlock in the replication logic. In the second place, it'd be a deviation from the current behavior (namely that a failure in CREATE DATABASE et al rolls back previous un-synced commands) that is not necessary to fix a bug, so changing that in the back branches would be a hard sell. I don't even agree that it's obviously better than the current behavior, so I'm not much on board with changing it in HEAD either. regards, tom lane