diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-25 15:09:05 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-25 15:09:05 +0900 |
commit | 9d5217db5dce5e61cf3308329d94593a0e1cf6ff (patch) | |
tree | dba15711879cbf3cc5b4b5f2f0bbcd7b9ce0030a /activerecord/lib/active_record/connection_adapters | |
parent | 2f8d22f292a322a54812c5be5bd2fa5ee119d411 (diff) | |
download | rails-9d5217db5dce5e61cf3308329d94593a0e1cf6ff.tar.gz rails-9d5217db5dce5e61cf3308329d94593a0e1cf6ff.tar.bz2 rails-9d5217db5dce5e61cf3308329d94593a0e1cf6ff.zip |
Prefer `USING (column_list)` for joining information_schema
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index aaa67a9ea2..f7f3a1521b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -367,9 +367,7 @@ module ActiveRecord SELECT column_name FROM information_schema.key_column_usage kcu JOIN information_schema.table_constraints tc - ON kcu.table_name = tc.table_name - AND kcu.table_schema = tc.table_schema - AND kcu.constraint_name = tc.constraint_name + USING (table_schema, table_name, constraint_name) WHERE constraint_type = 'PRIMARY KEY' AND kcu.table_name = #{scope[:name]} AND kcu.table_schema = #{scope[:schema]} |