diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-11-26 11:59:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 11:59:05 -0500 |
commit | 713e75d46dc75274a996661ed3ff773bc481d7a5 (patch) | |
tree | 8fdbc7bbd8ad0072f9b3a270be0cf91516fd1346 /activerecord/lib | |
parent | 0fe258dbf9e32422ab1281af0279fa0ef37429a9 (diff) | |
parent | 6fb128d14427019b10e1ac5205f48f72feffe767 (diff) | |
download | rails-713e75d46dc75274a996661ed3ff773bc481d7a5.tar.gz rails-713e75d46dc75274a996661ed3ff773bc481d7a5.tar.bz2 rails-713e75d46dc75274a996661ed3ff773bc481d7a5.zip |
Merge pull request #34520 from yahonda/bump_pg93
Bump the minimum version of PostgreSQL to 9.3
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 31 |
2 files changed, 17 insertions, 19 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index bd095fbc73..f73369ceef 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -314,6 +314,11 @@ module ActiveRecord false end + # Does this adapter support materialized views? + def supports_materialized_views? + false + end + # Does this adapter support datetime with precision? def supports_datetime_with_precision? false diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 1cef8339f5..1c4e625ead 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -185,7 +185,7 @@ module ActiveRecord end def supports_json? - postgresql_version >= 90200 + true end def supports_comments? @@ -332,16 +332,16 @@ module ActiveRecord end def supports_ranges? - # Range datatypes weren't introduced until PostgreSQL 9.2 - postgresql_version >= 90200 + true end + deprecate :supports_ranges? def supports_materialized_views? - postgresql_version >= 90300 + true end def supports_foreign_tables? - postgresql_version >= 90300 + true end def supports_pgcrypto_uuid? @@ -425,8 +425,8 @@ module ActiveRecord private def check_version - if postgresql_version < 90100 - raise "Your version of PostgreSQL (#{postgresql_version}) is too old. Active Record supports PostgreSQL >= 9.1." + if postgresql_version < 90300 + raise "Your version of PostgreSQL (#{postgresql_version}) is too old. Active Record supports PostgreSQL >= 9.3." end end @@ -589,18 +589,11 @@ module ActiveRecord def load_additional_types(oids = nil) initializer = OID::TypeMapInitializer.new(type_map) - if supports_ranges? - query = <<~SQL - SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype - FROM pg_type as t - LEFT JOIN pg_range as r ON oid = rngtypid - SQL - else - query = <<~SQL - SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, t.typtype, t.typbasetype - FROM pg_type as t - SQL - end + query = <<~SQL + SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype + FROM pg_type as t + LEFT JOIN pg_range as r ON oid = rngtypid + SQL if oids query += "WHERE t.oid::integer IN (%s)" % oids.join(", ") |