Querying a custom postgresql parameter using a SELECT statement

In another question , a question was asked about how to query the postgresql runtime parameter (e.g. SHOW search_path; ) using a SELECT query. The answer suggested using

 SELECT * FROM pg_settings WHERE name = 'search_path'; 

This works fine, but how can this be done for custom parameters defined in the extension? (See Documents on Individual Parameters ).

Example:

 SET abc.my_var = 1; SHOW abc.my_var; 

exits

 1 

but

 SELECT * FROM pg_settings WHERE name = 'abc.my_var'; 

does not return a string. Is there any other table / view that I can query for my custom parameter using the SELECT statement?

+6
source share
1 answer

Use the current_setting() function

 SELECT current_setting('abc.my_var'); 

http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-SET

+3
source

All Articles