diff options
author | Derek Prior <derekprior@gmail.com> | 2015-12-30 08:49:14 -0500 |
---|---|---|
committer | Derek Prior <derekprior@gmail.com> | 2015-12-30 08:49:14 -0500 |
commit | 8ad1eeafc2d4b0d96f0218b5272ea734564bd875 (patch) | |
tree | 6d58478c0188d71502f7cfdfec8a26fbf4f52a95 /activerecord | |
parent | 2ad6deb5344abd77515f1c04edbd586a5538f705 (diff) | |
download | rails-8ad1eeafc2d4b0d96f0218b5272ea734564bd875.tar.gz rails-8ad1eeafc2d4b0d96f0218b5272ea734564bd875.tar.bz2 rails-8ad1eeafc2d4b0d96f0218b5272ea734564bd875.zip |
Make `postgresql_version` public
This is useful to libraries that want to feature gate based on the
version of PostgreSQL the user is connected to. For instance, I want to
know if the user is connected to a version of Postgres that supports
concurrent materialized view refreshes. I could add that as a method on
the adapter as a PR, but rails has no need for this itself.
Rails is already using the postgresql_version for its own feature gating
and this makes that possible for other libraries.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index a1ec570042..e313a34c3a 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -390,12 +390,12 @@ module ActiveRecord "average" => "avg", } - protected + # Returns the version of the connected PostgreSQL server. + def postgresql_version + @connection.server_version + end - # Returns the version of the connected PostgreSQL server. - def postgresql_version - @connection.server_version - end + protected # See http://www.postgresql.org/docs/current/static/errcodes-appendix.html FOREIGN_KEY_VIOLATION = "23503" |