Permalink
Browse files

Revert "[activerecord][postgresql] verify if table has a schema(not p…

…ublic)". This caused a test breakage. See #1410 for details.

This reverts commit c44418e.
  • Loading branch information...
1 parent 576f712 commit 4067d88df59aa86743a9e4122ca72efd71c932b2 @jonleighton jonleighton committed May 31, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
View
11 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -659,10 +659,7 @@ def drop_database(name) #:nodoc:
# 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 @@ def pk_and_sequence_for(table) #:nodoc:
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

0 comments on commit 4067d88

Please sign in to comment.