Skip to content

Commit 5b714e7

Browse files
committed
2-0-stable: Remove table quoting; only pull last_insert_id if there's a primary key.
Merging [8663] git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/2-0-stable@8860 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
1 parent f000028 commit 5b714e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ def select_rows(sql, name = nil)
386386

387387
# Executes an INSERT query and returns the new record's ID
388388
def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
389-
table = sql.split(" ", 4)[2]
390-
super || last_insert_id(table, sequence_name || default_sequence_name(table, pk))
389+
table = sql.split(" ", 4)[2].gsub('"', '')
390+
super || pk && last_insert_id(table, sequence_name || default_sequence_name(table, pk))
391391
end
392392

393393
# Queries the database and returns the results in an Array or nil otherwise.

0 commit comments

Comments
 (0)