Re: Getting available options - Mailing list pgsql-hackers

From Dave Page
Subject Re: Getting available options
Date
Msg-id 937d27e10802190546j7e6552d4y63d084e709759539@mail.gmail.com
Whole thread Raw
In response to Getting available options  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Getting available options  ("Gevik Babakhani" <pgdev@xs4all.nl>)
List pgsql-hackers
On Feb 19, 2008 1:22 PM, Magnus Hagander <magnus@hagander.net> wrote:
> I'd like to add a way for a client (in this case, typicallyi pgadmin,
> phppgadmin or similar) to get the available options on the server for the
> GUC settings we have that take fixed options. This is to make it possible
> to generate pretty dropdown lists of the options.
>
> One way would be to simply pre-populate the client with the available
> options. This sucks in at least two cases - the client has to be updated
> whenever the server is. And, more importantly, in some cases the available
> options depend on server-side build-time configuration (for example,
> log_destination depends on win32/non win32 and syslog yes/no, wal_sync_method
> depends on what's available on the OS).
>
> In order to somehow get this data down from the client, I see a couple of
> ways:
>
> 1) Extend pg_settings with a column that contains an array of the available
> options. Extend the config_string GUC struct with a hook that can return
> this data.
>
> 2) Create a separate function, for the sake of argument
> pg_get_available_options(<optionname>). Extend config_string GUC struct the
> same way here.
>
> 3) Create one function for each of these, so a
> pg_get_available_log_destinations(), pg_get_available_wal_sync_methods()
> etc etc.
>
> 4) The best method available that I obviously didn't think of yet
>
>
> Option 3 seems like an excessively ugly solution :) But what about the others?
> What would people prefer?

I like option 1 the best. Minimally invasive, and probably easier to
handle on the client than 2. 3 is just ugly as you say. You should be
ashamed of yourself :-p

-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
The Oracle-compatible database company


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Getting available options
Next
From: Peter Eisentraut
Date:
Subject: Re: Getting available options