Permalink
Browse files

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
  • Loading branch information...
1 parent f000028 commit 5b714e719798549a0d76e7278dc67031de3a986d @NZKoz NZKoz committed Feb 12, 2008
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -386,8 +386,8 @@ def select_rows(sql, name = nil)
# Executes an INSERT query and returns the new record's ID
def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
- table = sql.split(" ", 4)[2]
- super || last_insert_id(table, sequence_name || default_sequence_name(table, pk))
+ table = sql.split(" ", 4)[2].gsub('"', '')
+ super || pk && last_insert_id(table, sequence_name || default_sequence_name(table, pk))
end
# Queries the database and returns the results in an Array or nil otherwise.

0 comments on commit 5b714e7

Please sign in to comment.