Re: Accessing other session's temp table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Mikhail Gribkov <youzhick(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Accessing other session's temp table
Date: 2024-11-21 15:09:35
Message-ID: CA+TgmoZarxOtNpaG6i3v2Hbs0suOX8mXLN6SauB=+MGczpnMeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 20, 2024 at 5:47 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Mikhail Gribkov <youzhick(at)gmail(dot)com> writes:
> > What do you think?
>
> I think this will break cases we don't want to break.
>
> Accessing the metadata of other temp tables is fine, and indeed
> necessary for operations like dropping them. It's access to
> the table contents that needs to be blocked. I'm surprised
> that we don't have sufficient tests at that level.
>
> [ experiments... ] It looks like this did work as expected up
> through v15. So somebody broke it fairly recently, perhaps
> as a side effect of the table-AM work. Might be worth bisecting
> to see where it broke.

Yeah, this is really odd. I don't understand why the first insert
didn't immediately fail, right here, in ReadBufferExtended:

/*
* Reject attempts to read non-local temporary relations; we would be
* likely to get wrong data since we have no visibility into the owning
* session's local buffers.
*/
if (RELATION_IS_OTHER_TEMP(reln))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot access temporary tables of other sessions")));

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-11-21 15:19:20 Re: Windows 2016 server crashed after changes in Postgres 15.8 pgAdmin
Previous Message David G. Johnston 2024-11-21 15:03:52 Re: Document NULL