Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biOq3-0004P6-4Z for pgsql-docs@arkaria.postgresql.org; Fri, 09 Sep 2016 16:39:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1biOq2-0005FC-4B for pgsql-docs@arkaria.postgresql.org; Fri, 09 Sep 2016 16:39:38 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1biOpe-0004qr-S3 for pgsql-docs@postgresql.org; Fri, 09 Sep 2016 16:39:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1biOpX-0002nx-UR for pgsql-docs@postgresql.org; Fri, 09 Sep 2016 16:39:13 +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 u89Gd6mR005492; Fri, 9 Sep 2016 12:39:06 -0400 From: Tom Lane To: chris+postgresql@qwirx.com cc: pgsql-docs@postgresql.org Subject: Re: SET CONSTRAINTS ALL IMMEDIATE affects SET TRANSACTION READ ONLY In-reply-to: <20160909065218.20022.15589@wrigleys.postgresql.org> References: <20160909065218.20022.15589@wrigleys.postgresql.org> Comments: In-reply-to chris+postgresql@qwirx.com message dated "Fri, 09 Sep 2016 06:52:18 -0000" Date: Fri, 09 Sep 2016 12:39:06 -0400 Message-ID: <5491.1473439146@sss.pgh.pa.us> X-Pg-Spam-Score: -3.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 chris+postgresql@qwirx.com writes: > We found that normally, if you execute SET TRANSACTION READ ONLY, it > prevents COMMIT from happening if any data has been changed in the > transaction (and we have been relying on this for safety). This seems like a truly bizarre expectation. 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. Which is what your examples seem to be doing. (I'm assuming something you didn't state, which is that you have a deferred constraint that causes a commit-time update in reaction to the explicit UPDATE; otherwise SET CONSTRAINTS ALL IMMEDIATE shouldn't have any effect at all.) 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