Re: user defined settings (aka user defined guc variables)
От | Bruce Momjian |
---|---|
Тема | Re: user defined settings (aka user defined guc variables) |
Дата | |
Msg-id | 200212190126.gBJ1Q6M26406@candle.pha.pa.us обсуждение исходный текст |
Ответ на | user defined settings (aka user defined guc variables) (Joe Conway <mail@joeconway.com>) |
Ответы |
Re: user defined settings (aka user defined guc variables)
|
Список | 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@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: