Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btlPz-0000P1-BZ for pgsql-docs@arkaria.postgresql.org; Tue, 11 Oct 2016 00:59:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btlPy-00042t-Id for pgsql-docs@arkaria.postgresql.org; Tue, 11 Oct 2016 00:59:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btlPc-0003Wn-8g for pgsql-docs@postgresql.org; Tue, 11 Oct 2016 00:59:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btlPV-0004kk-BC for pgsql-docs@postgresql.org; Tue, 11 Oct 2016 00:59:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9B0xBp3023997; Mon, 10 Oct 2016 20:59:11 -0400 From: Tom Lane To: Peter Eisentraut cc: chris+postgresql@qwirx.com, pgsql-docs@postgresql.org Subject: Re: SET CONSTRAINTS ALL IMMEDIATE affects SET TRANSACTION READ ONLY In-reply-to: References: <20160909065218.20022.15589@wrigleys.postgresql.org> <5491.1473439146@sss.pgh.pa.us> Comments: In-reply-to Peter Eisentraut message dated "Mon, 10 Oct 2016 20:47:33 -0400" Date: Mon, 10 Oct 2016 20:59:11 -0400 Message-ID: <23996.1476147551@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org Peter Eisentraut writes: > On 9/9/16 12:39 PM, Tom Lane wrote: >> I wouldn't really imagine that it's sensible to set READ ONLY >> mid-transaction at all, but if it means anything to do that, surely >> it ought to mean that no updates can happen *after* you set it. > I think there is a bit of code missing in check_transaction_read_only(). > We prevent changing from read-only to read-write after the first query > but not vice versa. That seems like an oversight. The comments around the code make it absolutely clear that it's intentional, not an "oversight". Whether it's a good idea is open for discussion, certainly, but I don't see how you can imagine that it wasn't considered. regards, tom lane -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs