Re: our checks for read-only queries are not great
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-01-09T20:07:28Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Maybe the SQL standard has something to say about this?
[ pokes around ... ] Yeah, it does, and I'd say it's pretty clearly
in agreement with what Peter did, so far as DML ops go. For instance,
this bit from SQL99's description of DELETE:
1) If the access mode of the current SQL-transaction or the access
mode of the branch of the current SQL-transaction at the current
SQL-connection is read-only, and T is not a temporary table,
then an exception condition is raised: invalid transaction state
- read-only SQL-transaction.
UPDATE and INSERT say the same. (I didn't look at later spec versions,
since Peter's 2003 commit was probably based on SQL99.)
You could argue about exactly how to extend that to non-spec
utility commands, but for the most part allowing them seems
to make sense if DML is allowed.
regards, tom lane
Commits
-
Fix problems with "read only query" checks, and refactor the code.
- 2eb34ac36974 13.0 landed
-
Read-only transactions, as defined in SQL.
- b65cd562402e 7.4.1 cited