Re: Prevent writes on large objects in read-only transactions

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Prevent writes on large objects in read-only transactions
Date: 2022-06-29 08:29:50
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello Michael-san,

Thank you for reviewing the patch. I attached the updated patch.

On Thu, 16 Jun 2022 17:31:22 +0900
Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> Looking at the docs of large objects, as of "Client Interfaces", we
> mention that any action must take place in a transaction block.
> Shouldn't we add a note that no write operations are allowed in a
> read-only transaction?

I added a description about read-only transaction to the doc.

> + if (mode & INV_WRITE)
> + PreventCommandIfReadOnly("lo_open() in write mode");
> Nit. This breaks translation. I think that it could be switched to
> "lo_open(INV_WRITE)" instead as the flag name is documented.

Changed it as you suggested.

> The patch is forgetting a refresh for largeobject_1.out.

I added changes for largeobject_1.out.

> --- INV_READ = 0x20000
> --- INV_WRITE = 0x40000
> +-- INV_READ = 0x40000
> +-- INV_WRITE = 0x20000
> Good catch! This one is kind of independent, so I have fixed it
> separately, in all the expected output files.


Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
v3_prevent_lo_writes_in_readonly.patch text/x-diff 8.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema 2022-06-29 09:02:56 Re: OpenSSL 3.0.0 compatibility
Previous Message Alexander Pyhalov 2022-06-29 08:01:37 Re: CREATE INDEX CONCURRENTLY on partitioned index