# File lib/active_record/connection_adapters/postgresql_adapter.rb, line 725 def table_exists?(name) schema, table = extract_schema_and_table(name.to_s) return false unless table # Abstract classes is having nil table name binds = [[nil, table.gsub(/(^"|"$)/,'')]] binds << [nil, schema] if schema exec_query("SELECT COUNT(*)\nFROM pg_tables\nWHERE tablename = $1\nAND schemaname = \#{schema ? \"$2\" : \"ANY (current_schemas(false))\"}\n", 'SCHEMA', binds).rows.first[0].to_i > 0 end