From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: chris+postgresql@qwirx.com
Cc: pgsql-docs@postgresql.org
Subject: Re: SET CONSTRAINTS ALL IMMEDIATE affects SET TRANSACTION READ ONLY
Date: Mon, 10 Oct 2016 20:47:33 -0400
Message-ID: <d5262e05-5d96-6090-d665-482f036e1717@2ndquadrant.com> (raw)
In-Reply-To: <5491.1473439146@sss.pgh.pa.us>
References: <20160909065218.20022.15589@wrigleys.postgresql.org>
<5491.1473439146@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>
On 9/9/16 12:39 PM, Tom Lane wrote:
> 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.
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.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us, chris+postgresql@qwirx.com
Subject: Re: SET CONSTRAINTS ALL IMMEDIATE affects SET TRANSACTION READ ONLY
In-Reply-To: <d5262e05-5d96-6090-d665-482f036e1717@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox