Re: Mark all GUC variable as PGDLLIMPORT - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Mark all GUC variable as PGDLLIMPORT
Date
Msg-id 202108231540.llqacduza3nx@alvherre.pgsql
Whole thread Raw
In response to Re: Mark all GUC variable as PGDLLIMPORT  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Mark all GUC variable as PGDLLIMPORT
List pgsql-hackers
On 2021-Aug-23, Robert Haas wrote:

> It's also a bit unfair to say, well we have APIs for accessing GUC
> values. It's true that we do. But if the GUC variable is, say, a
> Boolean, you do not want your extension to call some function that
> does a bunch of shenanigans and returns a string so that you can then
> turn around and parse the string to recover the Boolean value. Even
> moreso if the value is an integer or a comma-separated list. You want
> to access the value as the system represents it internally, not
> duplicate the parsing logic in a way that is inefficient and
> bug-prone.

In that case, why not improve the API with functions that return the
values in some native datatype?  For scalars with native C types (int,
floats, Boolean etc) this is easy enough; I bet it'll solve 99% of the
problems or more.

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Queries that should be canceled will get stuck on secure_write function
Next
From: Tom Lane
Date:
Subject: Regexp: observable bug from careless usage of zaptreesubs