aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorTravis Jeffery <travisjeffery@gmail.com>2012-03-07 04:22:07 +0000
committerTravis Jeffery <travisjeffery@gmail.com>2012-03-07 05:27:12 +0000
commit577971f05a838da3ba74ba49d776a83f6bfe1aee (patch)
tree274cae8b509dfcf181d2f9107906fda798ebc9a4 /activerecord/lib/active_record/connection_adapters
parentb4ac72c63890e139745f32a5c642ead548e038ba (diff)
downloadrails-577971f05a838da3ba74ba49d776a83f6bfe1aee.tar.gz
rails-577971f05a838da3ba74ba49d776a83f6bfe1aee.tar.bz2
rails-577971f05a838da3ba74ba49d776a83f6bfe1aee.zip
Add #schema_names to PostgreSQL Adapter.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index d2126a3e19..f4efaa9b20 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -978,6 +978,17 @@ module ActiveRecord
end_sql
end
+ # Returns an array of schema names.
+ def schema_names
+ query(<<-SQL).flatten
+ SELECT nspname
+ FROM pg_namespace
+ WHERE nspname !~ '^pg_.*'
+ AND nspname NOT IN ('information_schema')
+ ORDER by nspname;
+ SQL
+ end
+
# Sets the schema search path to a string of comma-separated schema names.
# Names beginning with $ have to be quoted (e.g. $user => '$user').
# See: http://www.postgresql.org/docs/current/static/ddl-schemas.html