Re: table_open/table_close with different lock mode

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: table_open/table_close with different lock mode
Date: 2023-07-21 06:26:22
Message-ID: ZLolDsKqNsAS/VpK@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 21, 2023 at 02:05:56PM +0800, Junwang Zhao wrote:
> I noticed there are some places calling table_open with
> RowExclusiveLock but table_close with NoLock, like in function
> toast_save_datum.
>
> Can anybody explain the underlying logic, thanks in advance.

This rings a bell. This is a wanted behavior, see commit f99870d and
its related thread:
https://postgr.es/m/17268-d2fb426e0895abd4@postgresql.org

The tests added by this commit in src/test/isolation/ will show the
difference in terms of the way the toast values get handled with and
without the change.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-07-21 06:34:40 Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication
Previous Message Michael Paquier 2023-07-21 06:24:19 Re: Support worker_spi to execute the function dynamically.