Rails: How to get PostgreSQL version being used

To check the currently running PG version from your Rails application (e.g. Rails console on your production server), simply do this:

ActiveRecord::Base.connection.select_value('SELECT version()')
Arne Hartherz