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

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: ZizhuanLiu X-MAN <44973863(at)qq(dot)com>
Cc: 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 18:52:06
Message-ID: CAJDiXgh_eCjJH-WC_P+vUZmoaXOWq98z8D-=27PhqGwUjFHhXQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sat, Jun 20, 2026 at 10:48 PM ZizhuanLiu X-MAN <44973863(at)qq(dot)com> wrote:
>
> 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().

Thank you for your feedback!

Do you mean that this check should be moved to "ExtendBufferedRelCommon"
because this function is in the bufmgr.c file? If so, I don't see the point in
that. Buffer manager is not only the bufmgr.c file, but also all the files in
the "storage/buffer" folder. So we can say that localbuf.c also contains logic
related to the buffer manager.

Moreover, ExtendBufferedRelCommon should contain only the logic that is really
common for both ordinary and temp tables. All other specific code is
encapsulated inside the ExtendBufferedRelLocal and ExtendBufferedRelShared. It
allows us to keep the ExtendBufferedRelCommon function pretty short.

So, I suggest leaving RELATION_IS_OTHER_TEMP as it is.

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

This comment is already updated - it now mentions the ExtendBufferedRelLocal
function.

--
Best regards,
Daniil Davydov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-06-20 21:30:58 Re: SQL/JSON: JSON_TRANSFORM (SQL standard, subclause 6.44)
Previous Message Zakariyah Ali 2026-06-20 17:49:06 [PATCH v2] Standardize log polling using wait_for_log() across recovery tests