diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 3e390ba994..b681871673 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -659,7 +659,10 @@ 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 tablename + SELECT case schemaname + when 'public' then tablename + else schemaname||'.'||tablename + end as tablename FROM pg_tables WHERE schemaname = ANY (current_schemas(false)) SQL @@ -830,11 +833,7 @@ module ActiveRecord end_sql # [primary_key, sequence] - if result.second == 'public' then - sequence = result.last - else - sequence = result.second+'.'+result.last - end + sequence = result.second == 'public' ? result.last : "#{result.second}.#{result.last}" [result.first, sequence] rescue |