mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
only support pg >= 8.2, so no need to check
This commit is contained in:
parent
7379114c2f
commit
35b2715456
1 changed files with 4 additions and 7 deletions
|
@ -435,13 +435,10 @@ module ActiveRecord
|
|||
# Extract the table from the insert sql. Yuck.
|
||||
table = sql.split(" ", 4)[2].gsub('"', '')
|
||||
|
||||
# Try an insert with 'returning id' if available (PG >= 8.2)
|
||||
if supports_insert_with_returning?
|
||||
pk, sequence_name = *pk_and_sequence_for(table) unless pk
|
||||
if pk
|
||||
id = select_value("#{sql} RETURNING #{quote_column_name(pk)}")
|
||||
return id
|
||||
end
|
||||
pk, sequence_name = *pk_and_sequence_for(table) unless pk
|
||||
if pk
|
||||
id = select_value("#{sql} RETURNING #{quote_column_name(pk)}")
|
||||
return id
|
||||
end
|
||||
|
||||
# Otherwise, insert then grab last_insert_id.
|
||||
|
|
Loading…
Reference in a new issue