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

From: Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>
To: Daniil Davydov <3danissimo(at)gmail(dot)com>
Cc: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG with accessing to temporary tables of other sessions still exists
Date: 2026-06-04 05:20:04
Message-ID: CA+UBfanx1GSOOa4GOFfM+SPqsT=DD2o+ob-tekJQ9GfChyZAnw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Got it, Thanks for making this clean.

Regards,
Imran Zaheer

On Wed, Jun 3, 2026 at 11:33 PM Daniil Davydov <3danissimo(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Thu, Jun 4, 2026 at 12:43 AM Imran Zaheer <imran(dot)zhir(at)gmail(dot)com> wrote:
> >
> > During testing this patch I also noticed that other sessions are also
> > able to drop the temporary table.
> >
> >
> > postgres=# drop table pg_temp_0.empty_table;
> > DROP TABLE
> >
> > Above command works just fine from the other session.
> >
> > I was able to fix that by adding the same check in
> > heap_drop_with_catalog in heap.c, but I'm not sure whether it's the
> > right place to add this check.
> >
> > Let me know if I am missing something.
> >
>
> It may be counter intuitive, but we allow dropping other session's temp tables.
> You can find the rationale for this in the 013_temp_obj_multisession.pl test.
> You can also read this message [1] in the previous discussion. In short, we
> prohibit looking at other-temp-table's pages not because they belong to another
> session, but because current temp_buffers implementation doesn't provide the
> ability to do so. Moreover, the ability to DROP other temp tables can be useful
> for autovacuum (see orphaned temp tables removal logic) and administrators.
>
> [1] https://www.postgresql.org/message-id/4075754.1774378690@sss.pgh.pa.us
>
> --
> Best regards,
> Daniil Davydov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-06-04 05:39:27 Re: Fix column privileges for pg_subscription.subwalrcvtimeout
Previous Message Michael Paquier 2026-06-04 04:50:59 Re: Improve pg_stat_statements scalability