Let's say I have a windows user environment variable SOME_STRING.
Is it possible to use its value in a PL/pgSQL function?
If not, do I need to use an untrusted language (like PL/pythonu) or can I use a trusted one?
I am on PG 9.2
You can not access a environment variable directly; but you can access a custom configuration setting and set that to a value from the environment at startup. For example, you can pass the follow startup option using
Note: the dot (
.) in the name is important.
Then retrieve the value using
(I have tried this on Linux and found it to be working, it should be the same for Windows, but may need some slight modification to cater of that particular platform.)