aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 392eadb9d5..c179be828e 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -441,18 +441,10 @@ module ActiveRecord
end
if pk
- id = select_value("#{sql} RETURNING #{quote_column_name(pk)}")
- return id
+ select_value("#{sql} RETURNING #{quote_column_name(pk)}")
+ else
+ super
end
-
- super
-
- return unless pk
-
- # If a pk is given, fallback to default sequence name.
- # Don't fetch last insert id for a table without a pk.
- sequence_name ||= "#{table}_#{pk}_seq"
- last_insert_id(sequence_name)
end
alias :create :insert