Getting available options - Mailing list pgsql-hackers

From Magnus Hagander
Subject Getting available options
Date
Msg-id 20080219132234.GL3091@svr2.hagander.net
Whole thread Raw
Responses Re: Getting available options  ("Dave Page" <dpage@pgadmin.org>)
Re: Getting available options  (Peter Eisentraut <peter_e@gmx.net>)
Re: Getting available options  (Simon Riggs <simon@2ndquadrant.com>)
List 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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Severe regression in autoconf 2.61
Next
From: "Dave Page"
Date:
Subject: Re: Getting available options