Re: Global temporary tables - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Global temporary tables
Date
Msg-id CAEZATCVeGPE-NdWMtOX99GiiR+o2ocyT0kEZB2CPprG-a5ivrg@mail.gmail.com
Whole thread
In response to Re: Global temporary tables  (Japin Li <japinli@hotmail.com>)
List pgsql-hackers
On Tue, 7 Jul 2026 at 02:09, Japin Li <japinli@hotmail.com> wrote:
>
> On Mon, 06 Jul 2026 at 11:12, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> > Regarding pg_class.reloncommit, 'p' (preserve) seems correct for a
> > sequence attached to a GTT with ON COMMIT DELETE ROWS, because the
> > sequence data is preserved. For indexes, not so much, because the
> > index data is deleted on commit. I guess it could be NULL for anything
> > that's not a table.
> >
>
> +1 for setting it to NULL for non‑table objects, since CREATE INDEX and
> CREATE SEQUENCE do not support the ON COMMIT clause.
>

After thinking about that some more, I decided that it was neater to
go with reloncommit = 'n' (for "none") rather than NULL for relations
that aren't temporary tables (and for temporary tables without an ON
COMMIT action). That's simpler for the code that reads it, so it
doesn't need to worry about NULLs. Also, since nearly every other
column of pg_class is marked NOT NULL, it seems neater to do the same
here too.

Attached is a rebased patchset doing that, plus a number of other
fixes in response to other review comments. This now includes some
additional pg_dump tests and tab-completion support.

Regards,
Dean

Attachment

pgsql-hackers by date:

Previous
From: Rui Zhao
Date:
Subject: Re: allow spread checkpoints when changing checksums online
Next
From: Dean Rasheed
Date:
Subject: Re: Global temporary tables