aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-05-31 22:43:44 +0100
committerJon Leighton <j@jonathanleighton.com>2011-05-31 22:46:13 +0100
commit4067d88df59aa86743a9e4122ca72efd71c932b2 (patch)
tree5d71a7fc94a0216c565a6ca420a57134a145fa55 /activerecord
parent576f712380c5c02994ee14ff563c48d529b37881 (diff)
downloadrails-4067d88df59aa86743a9e4122ca72efd71c932b2.tar.gz
rails-4067d88df59aa86743a9e4122ca72efd71c932b2.tar.bz2
rails-4067d88df59aa86743a9e4122ca72efd71c932b2.zip
Revert "[activerecord][postgresql] verify if table has a schema(not public)". This caused a test breakage. See #1410 for details.
This reverts commit c44418ea4e09cc81da47edbc9ac5f31c7e32c1b4.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index b681871673..3e390ba994 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -659,10 +659,7 @@ module ActiveRecord
# Returns the list of all tables in the schema search path or a specified schema.
def tables(name = nil)
query(<<-SQL, 'SCHEMA').map { |row| row[0] }
- SELECT case schemaname
- when 'public' then tablename
- else schemaname||'.'||tablename
- end as tablename
+ SELECT tablename
FROM pg_tables
WHERE schemaname = ANY (current_schemas(false))
SQL
@@ -833,7 +830,11 @@ module ActiveRecord
end_sql
# [primary_key, sequence]
- sequence = result.second == 'public' ? result.last : "#{result.second}.#{result.last}"
+ if result.second == 'public' then
+ sequence = result.last
+ else
+ sequence = result.second+'.'+result.last
+ end
[result.first, sequence]
rescue