In another question, it was asked how to query a postgresql runtime parameter (e.g. SHOW search_path;
) using a SELECT query. In the answer, it was suggested to use
SELECT * FROM pg_settings WHERE name = 'search_path';
This works great, but how can this be done for custom parameters defined in an extension? (See docs about Customized Options).
Example:
SET abc.my_var = 1;
SHOW abc.my_var;
outputs
1
but
SELECT * FROM pg_settings WHERE name = 'abc.my_var';
returns no rows. Is there some other table/view I can query for my custom parameter using a SELECT statement?
Use the function current_setting()
SELECT current_setting('abc.my_var');
http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-SET
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With