Re: [PATCH] Allow complex data for GUC extra. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [PATCH] Allow complex data for GUC extra.
Date
Msg-id CA+TgmobH-BGhEccHyzCwrEe3z783E0n5=ay3k5hzMBZrrBZGKg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Allow complex data for GUC extra.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] Allow complex data for GUC extra.
List pgsql-hackers
On Tue, Dec 16, 2025 at 4:49 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alternatively: I don't see any really good reason for a check_hook
> to be setting other GUCs, in fact it's probably a seriously bad idea.
> (It's a *check* hook, it's not supposed to be causing any
> side-effects.)  Therefore, there can be at most one of these
> operations in flight at a time, so you don't need any dynamic data
> structure.  A simple static variable remembering a not-yet-reparented
> context would do it.

Oh, yeah, I actually wondered if that would be an acceptable
restriction and had it in an earlier version of the email, but it got
lost in the final draft. Maybe with this design you just do something
like:

if (TempCheckHookConteck != NULL)
     MemoryContextReset(TempCheckHookConteck);
else
     TempCheckHookConteck = AllocSetContextCreate(...);

So then if the context survives, you just reset and reuse it, but if
it gets reparented, you set the variable to NULL and create a new
context the next time. Then you don't need any integration with
(sub)transaction abort at all, which seems nice.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions
Next
From: Thomas Munro
Date:
Subject: Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ?barriers