Re: Accessing other session's temp table - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Accessing other session's temp table
Date
Msg-id CA+TgmoZarxOtNpaG6i3v2Hbs0suOX8mXLN6SauB=+MGczpnMeQ@mail.gmail.com
Whole thread Raw
In response to Re: Accessing other session's temp table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Nov 20, 2024 at 5:47 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Mikhail Gribkov <youzhick@gmail.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



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Document NULL
Next
From: Robert Haas
Date:
Subject: Re: Windows 2016 server crashed after changes in Postgres 15.8 pgAdmin