Re: Getting available options

From: "Dave Page" <dpage(at)pgadmin(dot)org>
To: "Magnus Hagander" <magnus(at)hagander(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Getting available options
Date: 2008-02-19 13:46:58
Message-ID: 937d27e10802190546j7e6552d4y63d084e709759539@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Feb 19, 2008 1:22 PM, Magnus Hagander <magnus(at)hagander(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-02-19 13:56:42 Re: Getting available options
Previous Message Magnus Hagander 2008-02-19 13:22:34 Getting available options