Re: Global temporary tables - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Global temporary tables
Date
Msg-id CAEZATCXz3TCmjH=KfehyKrXrJkCf8TsgeE5S4v7O+g6vb87KVg@mail.gmail.com
Whole thread
In response to Re: Global temporary tables  (John Naylor <johncnaylorls@gmail.com>)
Responses Re: Global temporary tables
List pgsql-hackers
On Sun, 5 Jul 2026 at 09:17, John Naylor <johncnaylorls@gmail.com> wrote:
>
> BEGIN;
>   SELECT count(*) FROM g;    -- first access here: queues g's pg_temp_class row
>                              -- (still unflushed inside this transaction)
>   SAVEPOINT s1;
>     DROP TABLE g;            -- removes that pending queue entry
>   ROLLBACK TO s1;            -- pg_class row is restored by MVCC;
>                              -- the queue entry is not restored
>   INSERT INTO g VALUES (1);  -- the table still works normally
> COMMIT;
>
> I'm starting to think the queue mechanism needs serious attention, if
> not a complete re-think.

Thanks for looking!

Yes, you're right. In that example, the pg_temp_class tuple gets lost
entirely. It really needs the same sort of sub XID tracking as the
usage/storage code, to ensure that they never get lost. I'll take a
look.

Regards,
Dean



pgsql-hackers by date:

Previous
From: "ZizhuanLiu X-MAN"
Date:
Subject: Re: support create index on virtual generated column.
Next
From: Tatsuya Kawata
Date:
Subject: Re: Improving display of octal GUCs