Flowdock
method

primary_keys

Importance_0
v5.2.3 - Show latest stable - 0 notes - Class: SchemaStatements
primary_keys(table_name) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 355
        def primary_keys(table_name) # :nodoc:
          query_values(            SELECT a.attname              FROM (                     SELECT indrelid, indkey, generate_subscripts(indkey, 1) idx                       FROM pg_index                      WHERE indrelid = #{quote(quote_table_name(table_name))}::regclass                        AND indisprimary                   ) i              JOIN pg_attribute a                ON a.attrelid = i.indrelid               AND a.attnum = i.indkey[i.idx]             ORDER BY i.idx.strip_heredoc, "SCHEMA")
        end
Register or log in to add new notes.