aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb4
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]}