diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-01-29 10:18:45 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-01-29 10:18:45 -0200 |
commit | 610958a0c0f4d6b092608067f1ab93aefcc77945 (patch) | |
tree | b1e3c0dd0a04f78c11051745850094da711deee8 /activerecord/lib | |
parent | eba172fb76ee46d9d801a5f3e56af7b777c9a13e (diff) | |
download | rails-610958a0c0f4d6b092608067f1ab93aefcc77945.tar.gz rails-610958a0c0f4d6b092608067f1ab93aefcc77945.tar.bz2 rails-610958a0c0f4d6b092608067f1ab93aefcc77945.zip |
Only search for enabled extension if the PostgreSQL version supports
extensions
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index a2b32bf3e2..9169ace9f7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -594,9 +594,11 @@ module ActiveRecord end def extension_enabled?(name) - res = exec_query "SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '#{name}' AND installed_version IS NOT NULL)", - 'SCHEMA' - res.column_types['exists'].type_cast res.rows.first.first + if supports_extensions + res = exec_query "SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '#{name}' AND installed_version IS NOT NULL)", + 'SCHEMA' + res.column_types['exists'].type_cast res.rows.first.first + end end # Returns the configured supported identifier length supported by PostgreSQL |