set_config() documentation clarification

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: set_config() documentation clarification
Date: 2021-01-04 15:25:26
Message-ID: ee989979-6e04-4811-a7ac-071f69b3f689@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just learned from a pg friend, it's possible to set your own made up setting_name using set_config(),
if the setting_name contains at least one dot ".".

I didn't know about this and have always thought it's not possible,
due to early in my career having run into the error message
you get when not having a dot in the name:

SELECT set_config('foobar','test',true);
ERROR: unrecognized configuration parameter "foobar"

If instead having a dot in the name, it works:

SELECT set_config('foo.bar','test',true);
set_config
------------
test
(1 row)

In the documentation at https://www.postgresql.org/docs/current/functions-admin.html
this behaviour is not mentioned anywhere as far as I can see:

"set_config ( setting_name text, new_value text, is_local boolean ) → text

Sets the parameter setting_name to new_value, and returns that value. If is_local is true, the new value will only apply for the current transaction. If you want the new value to apply for the current session, use false instead. This function corresponds to the SQL command SET."

Perhaps a paragraph where this is clarified should be added?

Kind regards,

Joel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2021-01-04 15:34:08 Re: PoC/WIP: Extended statistics on expressions
Previous Message Andrew Dunstan 2021-01-04 15:12:32 Re: Safety/validity of resetting permissions by updating system tables