From 426113fde44b466247a1a7ace38bb23ba5d8b3b7 Mon Sep 17 00:00:00 2001 From: Martin Hradil Date: Fri, 12 Oct 2018 13:01:40 +0000 Subject: [PATCH] Drop postgresql < 9.5 references only 9.5 is supported now, no point in keeping workarounds for older versions --- config/initializers/postgres_required_versions.rb | 4 ++-- lib/extensions/ar_adapter/ar_dba.rb | 2 +- lib/extensions/ar_table_lock.rb | 2 +- spec/models/vmdb_database_spec.rb | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config/initializers/postgres_required_versions.rb b/config/initializers/postgres_required_versions.rb index 91a7ac2749d..a9035745c65 100644 --- a/config/initializers/postgres_required_versions.rb +++ b/config/initializers/postgres_required_versions.rb @@ -2,8 +2,8 @@ def initialize(*args) super - if postgresql_version < 90400 - raise "The version of PostgreSQL being connected to is incompatible with #{Vmdb::Appliance.PRODUCT_NAME} (9.4+ required)" + if postgresql_version < 90500 + raise "The version of PostgreSQL being connected to is incompatible with #{Vmdb::Appliance.PRODUCT_NAME} (9.5 required)" end if postgresql_version >= 90600 diff --git a/lib/extensions/ar_adapter/ar_dba.rb b/lib/extensions/ar_adapter/ar_dba.rb index c49ae5ab204..98552dfd22f 100644 --- a/lib/extensions/ar_adapter/ar_dba.rb +++ b/lib/extensions/ar_adapter/ar_dba.rb @@ -502,7 +502,7 @@ def text_table_indexes(table_name, name = "Text Table Indexes") INNER JOIN pg_class i ON d.indexrelid = i.oid WHERE i.relkind = 'i' AND t.relkind = 't' - AND i.oid = #{postgresql_version >= 90400 ? 'd.indexrelid' : 't.reltoastidxid'} + AND i.oid = d.indexrelid AND t.relname = '#{table_name}' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = 'pg_toast' ) ORDER BY i.relname diff --git a/lib/extensions/ar_table_lock.rb b/lib/extensions/ar_table_lock.rb index 92cb1567604..88a58ec816b 100644 --- a/lib/extensions/ar_table_lock.rb +++ b/lib/extensions/ar_table_lock.rb @@ -7,7 +7,7 @@ module ArTableLock # It is self-exclusive so that only one session can hold it at a time. # # details on locks can be found on postgres docs: - # can be fount http://www.postgresql.org/docs/9.4/static/explicit-locking.html + # http://www.postgresql.org/docs/9.5/static/explicit-locking.html # def with_lock(timeout = 60.seconds) lock = "SHARE ROW EXCLUSIVE" diff --git a/spec/models/vmdb_database_spec.rb b/spec/models/vmdb_database_spec.rb index f4cfb94081b..c5a9bb1c158 100644 --- a/spec/models/vmdb_database_spec.rb +++ b/spec/models/vmdb_database_spec.rb @@ -73,7 +73,6 @@ context ".report_client_connections" do it "will return an array of hashes and verify hash keys for client connections query" do - skip("awaiting CI database upgrade to 9.2.4") if (described_class.connection.send(:postgresql_version) rescue nil).to_i < 90200 connections = described_class.report_client_connections expect(connections).to be_kind_of(Array)