Re: user defined settings (aka user defined guc variables)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: user defined settings (aka user defined guc variables)
Date: 2002-12-19 01:26:06
Message-ID: 200212190126.gBJ1Q6M26406@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


What exactly can you do with these variables other than SHOW/SET. Seems
it would be nice if they could be used in queries, like in a special
table like sysvar:

SELECT sysvar.fsync;

---------------------------------------------------------------------------

Joe Conway wrote:
> I've been playing around with making it possible to create user defined guc
> variables. This has been discussed, at least in passing, before. And it is
> even anticipated in guc.c as a possible future feature:
> /*
> * Build the sorted array. This is split out so that it could be
> * re-executed after startup (eg, we could allow loadable modules to
> * add vars, and then we'd need to re-sort).
> */
>
> It is a feature that would be nice to have, so that, for example, a user
> defined variable named "my_classpath" could be created to point to the java
> CLASSPATH needed by a custom C function.
>
> So far I have this much working:
> - A new backend function, pg_create_user_setting(name, value, islocal) is used
> to "register" the setting.
> - SHOW ALL, SHOW, current_setting(), and pg_show_all_settings()) will display
> it just like any other setting
> - Similarly, SET and set_config() will change it.
>
> I still need to make the user defined settings survive being saved by ALTER
> USER or ALTER DATABASE. I'm also thinking about a corresponding grammar
> addition, something along the lines of:
>
> CREATE SETTING name WITH VALUE value;
>
> This would effectively perform:
> SELECT pg_create_user_setting(name, value, false);
>
> I'm wondering whether it would be "a good thing" or "a bad thing" to have
> unrecognized settings found in postgresql.conf be registered as user defined
> settings?
>
> Any comments, concerns, or objections?
>
> Thanks,
>
> Joe
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Mascari 2002-12-19 01:28:15 Re: user defined settings (aka user defined guc variables)
Previous Message Gavin Sherry 2002-12-19 01:24:00 Re: user defined settings (aka user defined guc variables)