instance method resolved_tables

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

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

schema req
tables req
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

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close