diff options
author | Jordan Lewis <jordanthelewis@gmail.com> | 2017-02-10 02:35:24 -0500 |
---|---|---|
committer | Jordan Lewis <jordanthelewis@gmail.com> | 2017-02-13 15:20:21 -0500 |
commit | b8e3af79ed0c2121c11bbb675dbf47126e95e0a0 (patch) | |
tree | 0eef428894b74cb1d87c08c9e238846243cd8aad /activerecord/test/cases/migration_test.rb | |
parent | b9bee5e895e218b17a5f4ad72c3cbf6204fa4145 (diff) | |
download | rails-b8e3af79ed0c2121c11bbb675dbf47126e95e0a0.tar.gz rails-b8e3af79ed0c2121c11bbb675dbf47126e95e0a0.tar.bz2 rails-b8e3af79ed0c2121c11bbb675dbf47126e95e0a0.zip |
Simplify and optimize Postgres query for primary_keys()
primary_keys(table) needs to query various metadata tables in Postgres
to determine the primary key for the table. Previously, it did so using
a complex common table expression against pg_constraint and
pg_attribute.
This patch simplifies the query by using information_schema tables.
This simplifies the logic, making the query far easier to understand,
and additionally avoids an expensive unnest, window function query, and
common table expression.
Diffstat (limited to 'activerecord/test/cases/migration_test.rb')
0 files changed, 0 insertions, 0 deletions