Re: BUG #18492: Adding a toasted column to a table with an inherited temp table fails with Assert

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18492: Adding a toasted column to a table with an inherited temp table fails with Assert
Date: 2024-06-03 21:03:11
Message-ID: 138617.1717448591@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2024-06-03 13:50:22 -0400, Tom Lane wrote:
>> I'm inclined to think that we should reject any ALTER TABLE on another
>> session's temp table.

> +1

The attached seems to do the trick. I initially thought of adding
the check to CheckTableNotInUse, but that is problematic because it
would keep us from cleaning out a temp schema that had belonged to
some other backend. So I added YA wrapper routine.

I've gone through all the other callers of CheckTableNotInUse, and
they appear to have checks of RELATION_IS_OTHER_TEMP where necessary,
so there don't seem to be any related holes. With a different
factorization we could perhaps merge those other checks, but it
would be more invasive and we'd not gain all that much.

We could set up a test of this error path, but it'd require an
isolation or TAP script, and I'm unconvinced that it's worth the
trouble. The most likely breakage is for someone to forget to
make this check in some new code path, and a test using existing
features would not catch that.

regards, tom lane

Attachment Content-Type Size
disallow-alter-other-temp-table-v1.patch text/x-diff 6.7 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2024-06-03 21:22:22 Re: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607
Previous Message Andres Freund 2024-06-03 19:20:54 Re: BUG #18493: COPY FROM STDIN BINARY failure