Re: BUG with accessing to temporary tables of other sessions still exists

From: ZizhuanLiu X-MAN <44973863(at)qq(dot)com>
To: Daniil Davydov <3danissimo(at)gmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG with accessing to temporary tables of other sessions still exists
Date: 2026-06-20 15:48:55
Message-ID: tencent_696AA44657F8BCB63C5AAB09EBEF0A4B6B07@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>Hi,
>
>On Wed, Jun 3, 2026 at 10:20?PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
>>
>> Session 1 here does not create a temporary table (most likely a copy &
>> paste error), but I could reproduce this error as you suggested:
>>
>
>Sorry, I wrote it manually and forgot to specify "TEMP". It is implied here,
>of course.
>
>>
>> At a first glance the check seems reasonable. One tiny wording nit: the
>> comment in ExtendBufferedRelLocal says "... covering any attempt to
>> extend local relation.", but to avoid any confusing with the meaning of
>> RELATION_IS_LOCAL I'd argue that "covering any attempt to extend a
>> temporary relation" would be slightly clearer.
>>
>
>Thanks for looking into this! I agree with your comment.
>
>Please, see v2 patch with fixed comment.
>
>--
>Best regards,
>Daniil Davydov

Hi, Daniil , Jim

Just as described in the comment of RELATION_IS_OTHER_TEMP macro in rel.h,
existing buffer manager routines including ReadBuffer_common(), StartReadBuffersImpl()
and PrefetchBuffer() have already invoked this macro to check cross-session temporary
table access. All these functions are located in bufmgr.c.

For code consistency, I suggest adding the same RELATION_IS_OTHER_TEMP check in
ExtendBufferedRelCommon() (also in bufmgr.c), right before calling ExtendBufferedRelLocal().

Meanwhile, we should also update the comment of RELATION_IS_OTHER_TEMP accordingly
to keep the documentation synchronized with code changes.

regards,
--
ZizhuanLiu (X-MAN) 
44973863(at)qq(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bryan Green 2026-06-20 17:48:05 Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain
Previous Message Peter Eisentraut 2026-06-20 13:16:04 Re: PG20 Minimum Dependency Thread