Re: Mark all GUC variable as PGDLLIMPORT
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chapman Flack <chap@anastigmatix.net>
Cc: Julien Rouhaud <rjuju123@gmail.com>, Andres Freund <andres@anarazel.de>,
Michael Paquier <michael@paquier.xyz>,
pgsql-hackers@lists.postgresql.org
Date: 2022-02-13T20:16:58Z
Lists: pgsql-hackers
Chapman Flack <chap@anastigmatix.net> writes:
> On 02/13/22 02:29, Julien Rouhaud wrote:
>> Maybe we could have an actually usable GUC API to retrieve values in their
>> native format rather than C string for instance, that we could make sure also
>> works for cases like max_backend?
> I proposed a sketch of such an API for discussion back in [0] (the second
> idea in that email, the "what I'd really like" one).
> In that scheme, some extension code that was interested in (say,
> for some reason) log_statement_sample_rate could say:
> static double samprate;
> static int gucs_changed = 0;
> #define SAMPRATE_CHANGED 1
> ...
> ObserveTypedConfigValue("log_statement_sample_rate",
> &samprate, &gucs_changed, SAMPRATE_CHANGED);
> ...
> and will be subscribed to have the native-format value stored into samprate,
> and SAMPRATE_CHANGED ORed into gucs_changed, whenever the value changes.
That seems like about 10X more complexity than is warranted,
not only in terms of the infrastructure required, but also in
the intellectual complexity around "just when could that value
change?"
Why not just provide equivalents to GetConfigOption() that can
deliver int, float8, etc values instead of strings?
(In any case we'd need to rethink the GUC "show_hook" APIs, which
currently need only deal in string output.)
regards, tom lane
Commits
-
Remove PGDLLIMPORT marker from __pg_log_level
- 8d3341266508 15.0 landed
-
Mark a few 'bbsink' related functions / variables static.
- b5f44225b833 15.0 landed
-
Add some missing PGDLLIMPORT markings
- 5edeb574285e 15.0 landed
-
Apply PGDLLIMPORT markings broadly.
- 8ec569479fc2 15.0 landed
-
Helper script to apply PGDLLIMPORT markings.
- 80900d469091 15.0 landed
-
Simplify declaring variables exported from libpgcommon and libpgport.
- e04a8059a74c 15.0 cited