Getting available options

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Getting available options
Date: 2008-02-19 13:22:34
Message-ID: 20080219132234.GL3091@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

//Magnus

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2008-02-19 13:46:58 Re: Getting available options
Previous Message Peter Eisentraut 2008-02-19 09:46:54 Re: Severe regression in autoconf 2.61