Skip to content

Commit

Permalink
Merge pull request #10504 from kennyj/support_pg_91
Browse files Browse the repository at this point in the history
Also should supports PostgreSQL 9.1 about extensions.
Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information
rafaelfranca committed May 16, 2013
1 parent c0f84c5 commit c637256
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions 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.

Expand Down
2 changes: 0 additions & 2 deletions activerecord/Rakefile
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit c637256

Please sign in to comment.