From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Malcolm Studd <mstudd(at)recognia(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problem with custom_variable_classes |
Date: | 2008-09-24 21:38:25 |
Message-ID: | 20080924213825.GA17162@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2008-09-24 22:10:20 | Re: case expression |
Previous Message | Asko Oja | 2008-09-24 20:13:38 | Re: Slony vs Longiste |