I have a postgresql function where I want to use get user defined environment variable. Is there any default function to get the environment variable directly ?
2 Answers
Since a function is running on the database server, you would get the environment of the database server process (I wonder if that is what you want). This should be restricted to superusers (or perhaps the pg_execute_server_program role).
There is no standard function for this, probably because it is mostly useless, but it should be easy to write a function in C, PL/PerlU or PL/PythonU to do that.
1 Comment
Shadi
This SO answer gives access to the general server environment (not the database server process environment)
No there is no SQL function available to do this.
But it should not be complicate to do using https://www.postgresql.org/docs/12/xfunc-c.html.