set_config() documentation clarification - Mailing list pgsql-hackers

From Joel Jacobson
Subject set_config() documentation clarification
Date
Msg-id ee989979-6e04-4811-a7ac-071f69b3f689@www.fastmail.com
Whole thread Raw
Responses Re: set_config() documentation clarification  (Chapman Flack <chap@anastigmatix.net>)
Re: set_config() documentation clarification  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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)


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

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Safety/validity of resetting permissions by updating system tables
Next
From: Dean Rasheed
Date:
Subject: Re: PoC/WIP: Extended statistics on expressions