1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Prevent write operations on large objects in read-only transactions

Attempting such an operation would already fail, but in various and
confusing ways.  For example, while in recovery, some elog() messages
would be reported, but these should never be user-facing.  This commit
restricts any write operations done on large objects in a read-only
context, so as the errors generated are more user-friendly.  This is per
the discussion done with Tom Lane and Robert Haas.

Some regression tests are added to check the case of all the SQL
functions working on large objects (including an update of the test's
alternate output).

Author: Yugo Nagata
Discussion: https://postgr.es/m/20220527153028.61a4608f66abcd026fd3806f@sraoss.co.jp
This commit is contained in:
Michael Paquier
2022-07-04 15:48:52 +09:00
parent 8ba3cb2f18
commit 55f4802785
5 changed files with 166 additions and 1 deletions

View File

@ -114,7 +114,9 @@
All large object manipulation using these functions
<emphasis>must</emphasis> take place within an SQL transaction block,
since large object file descriptors are only valid for the duration of
a transaction.
a transaction. Write operations, including <function>lo_open</function>
with the <symbol>INV_WRITE</symbol> mode, are not allowed in a read-only
transaction.
</para>
<para>