Re: problem with custom_variable_classes
От | hubert depesz lubaczewski |
---|---|
Тема | Re: problem with custom_variable_classes |
Дата | |
Msg-id | 20080924213825.GA17162@depesz.com обсуждение исходный текст |
Ответ на | problem with custom_variable_classes (Malcolm Studd <mstudd@recognia.com>) |
Ответы |
Re: problem with custom_variable_classes
Re: problem with custom_variable_classes |
Список | pgsql-general |
On Wed, Sep 24, 2008 at 12:15:41PM -0400, Malcolm Studd wrote: > I have a pl/pgSQL function[1] to calculate row numbers (based on [2]). > It uses a custom variable. This was working earlier, but is breaking now > saying it can't recognise the variable. The custom_variable_classes is > set in the postgresql.conf. > pgdb001=> select rownum('') from generate_series(1,10); > ERROR: unrecognized configuration parameter "olap.rownum_name" > pgdb001=> show custom_variable_classes; > custom_variable_classes > ------------------------- > olap > (1 row) > settings_id := current_setting('olap.rownum_name'); it looks like a bug to me. it did work in 8.2, and it doesn't in 8.3, or in 8.4. while manual in 8.4 still states: "When custom_variable_classes is set, the server will accept definitions of arbitrary variables within each specified class.". so it should work, but it doesn't: # show custom_variable_classes ; custom_variable_classes ------------------------- depesz (1 row) # select current_setting('depesz.xxx'); ERROR: unrecognized configuration parameter "depesz.xxx" of course i still can set a value, and then get it: # select set_config('depesz.xxx', 'xx', false); set_config ------------ xx (1 row) # select current_setting('depesz.xxx'); current_setting ----------------- xx (1 row) but it means that there is currently no way to check if there is value in this - i.e. if it has been initialized. i would suggest to return "NULL" when calling current_setting on unknown variable. this is not how it worked in 8.2 (it returned empty string), but NULL is (in my opinion) better choice. strangely - name of "current_setting" function nor "custom_variable_classes" doesn't show in any release docs, which makes the change somewhat mysterious. Best regards, depesz -- Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/ jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
В списке pgsql-general по дате отправления: