Skip to content
Browse files

Merge pull request #10504 from kennyj/support_pg_91

Also should supports PostgreSQL 9.1 about extensions.
Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information...
1 parent c0f84c5 commit c637256e17907570c6fd327b13d0580c03873061 @rafaelfranca rafaelfranca committed
View
4 activerecord/CHANGELOG.md
@@ -1,5 +1,9 @@
## unreleased ##
+* Also support extentions in PostgreSQL 9.1. This feature has been supported since 9.1.
+
+ *kennyj*
+
* Deprecate `ConnectionAdapters::SchemaStatements#distinct`,
as it is no longer used by internals.
View
2 activerecord/Rakefile
@@ -125,8 +125,6 @@ namespace :postgresql do
%w(arunit arunit2).each do |db|
if version < "9.1.0"
puts "Please prepare hstore data type. See http://www.postgresql.org/docs/9.0/static/hstore.html"
- else
- %x( psql #{config[db]['database']} -c "CREATE EXTENSION hstore;" )
end
end
end
View
8 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -623,9 +623,9 @@ def supports_explain?
true
end
- # Returns true if pg > 9.2
+ # Returns true if pg > 9.1
def supports_extensions?
- postgresql_version >= 90200
+ postgresql_version >= 90100
end
# Range datatypes weren't introduced until PostgreSQL 9.2
@@ -647,9 +647,9 @@ def disable_extension(name)
def extension_enabled?(name)
if supports_extensions?
- res = exec_query "SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '#{name}' AND installed_version IS NOT NULL)",
+ res = exec_query "SELECT EXISTS(SELECT * FROM pg_available_extensions WHERE name = '#{name}' AND installed_version IS NOT NULL) as enabled",
'SCHEMA'
- res.column_types['exists'].type_cast res.rows.first.first
+ res.column_types['enabled'].type_cast res.rows.first.first
end
end

0 comments on commit c637256

Please sign in to comment.
Something went wrong with that request. Please try again.