instance method
resolved_tables
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
resolved_tables(schema, tables)
An unqualified name resolves to the first schema on the search path that has it, the way ::regclass would for a single table. The readers join what they read against this, so a name is read from the one table it names rather than from every schema on the path that also has it.
Parameters
-
schemareq -
tablesreq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 981
def resolved_tables(schema, tables)
<<~SQL.chomp
WITH tables AS (
SELECT DISTINCT ON (c.relname) c.oid, c.relname, c.relkind
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE n.nspname = #{schema}
AND c.relname IN (#{quoted_table_names(tables)})
ORDER BY c.relname, array_position(current_schemas(false), n.nspname)
)
SQL
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb line 981
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements