Re: Reserving GUC prefixes from a non-preloaded DB extension is not always enforced

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Narek Galstyan <narekg(at)berkeley(dot)edu>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, narek(at)lantern(dot)dev
Subject: Re: Reserving GUC prefixes from a non-preloaded DB extension is not always enforced
Date: 2024-06-13 19:39:30
Message-ID: 2074489.1718307570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Narek Galstyan <narekg(at)berkeley(dot)edu> writes:
> I am an extension developer. I use `MarkGUCPrefixReserved` to reserve GUC
> prefixes, which my extension uses to help avoid accidentally misspelled
> config-file entries.

> However, since the reservation happens in `_PG_init()` and `_PG_init()` is
> not called until the first use of an API exposed by my extension,
> misspelled config-file entries that get executed before the extension is
> loaded will not throw an error.

No, but a warning will be reported when the extension does get loaded.

This seems in line to me with the general behavior of
extension-defined GUCs: we cannot know anything about whether a value
stored in the config file is sane until we have loaded the extension
that defines the GUC's data type, allowed range, etc.

> I'd expect GUC variables reserved by an extension to live more permanently
> in Postgres catalogs (e.g., in pg_settings).

How would they get there? What happens when the extension goes away?
How would such an approach emulate C-code-enforced restrictions,
that is checks made by a GUC check_hook? What happens if different
databases in an installation have inconsistent catalog entries for
a GUC? (You could eliminate such inconsistency by storing the data
in a shared catalog, perhaps, but that brings some other concerns.)

I don't really see the value for work expended here.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2024-06-13 19:50:07 Re: Reset sequence to current maximum value of rows
Previous Message David G. Johnston 2024-06-13 19:35:01 Re: Reset sequence to current maximum value of rows