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

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: ZizhuanLiu X-MAN <44973863@qq.com>
Cc: Daniil Davydov <3danissimo@gmail.com>, Jim Jones <jim.jones@uni-muenster.de>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-06-30T20:24:47Z
Lists: pgsql-hackers

Attachments

Hi!

On Sun, Jun 21, 2026 at 3:36 PM ZizhuanLiu X-MAN <44973863@qq.com> wrote:
> Indeed, compared with migrating all the checks into `localbuf.c`, this adjustment involves far fewer code changes.
>
> Thanks for updating the patch to v3. I've reviewed the changes, and everything looks correct
> and consistent with the existing buffer manager architecture.
>
> This placement of the RELATION_IS_OTHER_TEMP check in bufmgr.c perfectly follows
> the existing code pattern, so I have no further comments.

Thank you for your review.  Thanks to Daniil for the patch.  I made
some minor grammar corrections.

I'm going to push and backpatch this to 16 if no objections.
Backpatch to 16, because it's a first release after 31966b151e6, which
introduced a separate local relation extension function
ExtendBufferedRelLocal() lacking of RELATION_IS_OTHER_TEMP() check.

------
Regards,
Alexander Korotkov
Supabase

Commits

  1. Prevent access to other sessions' empty temp tables

  2. Add tests for cross-session temp table access

  3. Prevent access to other sessions' temp tables