Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Using PGAdmin III I can right-click on a database, navigate to the Variables tab, and put a variable name-value property on the database itself. Is there a way to customize these? I saw an application_name variable, but I'd like to have an application_version variable.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

You have to add the variable to the end of your postgresql.conf like

#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

custom_variable_classes = 'general'     # list of custom variable class names

general.application_version = 'v1.0'

When restarted, you can add general.application_version manually in PgAdmin (it will not show up in the drop-down - at least not for me). Otherwise, you can use it just like any other PostgreSQL variable.

share|improve this answer
    
Hmmm. No way to do that from a SQL query in the database? –  Jeremy Holovacs Dec 7 '12 at 12:50
    
You have to first define the variables in postgresql.conf. AFAIK this requires restarting PostgreSQL, so you can't do that from SQL. –  dezso Dec 7 '12 at 12:55
    
Thanks for the info. –  Jeremy Holovacs Dec 7 '12 at 13:35
add comment

To add to @dezso's answer, these variables can be changed with

SELECT set_config('class.name', 'value', valid_for_transaction_only::boolean)

and read with

SELECT current_setting('class.name')

See this link for more info: http://www.postgresql.org/docs/9.3/static/functions-admin.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.