Re: simply custom variables protection - Mailing list pgsql-patches

From Tom Lane
Subject Re: simply custom variables protection
Date
Msg-id 10506.1175967510@sss.pgh.pa.us
Whole thread Raw
In response to Re: simply custom variables protection  (Bruce Momjian <bruce@momjian.us>)
Responses Re: simply custom variables protection
List pgsql-patches
Bruce Momjian <bruce@momjian.us> writes:
> Pavel Stehule wrote:
>> My patch allows to allert somebody so any custom variable is protected.

> How does a user protect a custom variable using your code?  I don't see
> any API that would allow that.

The call would have to come from the loadable library that defines the
custom variable.  However, the complaint I had was that we already have
an API that should be able to do this, namely setting a protection level
higher than PGC_USERSET in the DefineCustomVariable call.  That doesn't
work today, but the right answer is to make it work, not invent more
functions.  This was agreed to be the right approach some time ago,
see thread here:
http://archives.postgresql.org/pgsql-hackers/2006-11/msg00911.php

Pavel's proposed patch complicates the API and the code, and offers only
part of the same functionality, ie, the equivalent of PGC_SUSET; but
I think that for example PGC_SIGHUP is a perfectly reasonable setting
to want to use with a custom variable.

Furthermore I believe the patch is incomplete/wrong, because it adds
only one check on the "armored" flag, whereas PGC_SUSET affects behavior
in a number of places.  I also notice that it will make setting of a
an armored custom variable from postgresql.conf fail outright in
non-superuser sessions, which is surely not desirable.

In short: this isn't a feature, it's a wart.

            regards, tom lane

pgsql-patches by date:

Previous
From: "Pavan Deolasee"
Date:
Subject: Re: [HACKERS] Optimized pgbench for 8.3
Next
From: "Pavel Stehule"
Date:
Subject: Re: simply custom variables protection