diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-19 02:43:31 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-19 02:43:31 +0000 |
commit | 3ffdfa84fc1f9bebc578fe957646af5f194ca625 (patch) | |
tree | 3567c6cc8b73191158669de8eccdc058faa6b0cd /activerecord/lib/active_record/connection_adapters | |
parent | ddbaacfd4ad4adb58a4762fe49b337c13d0bf397 (diff) | |
download | rails-3ffdfa84fc1f9bebc578fe957646af5f194ca625.tar.gz rails-3ffdfa84fc1f9bebc578fe957646af5f194ca625.tar.bz2 rails-3ffdfa84fc1f9bebc578fe957646af5f194ca625.zip |
Remove table quoting; only pull last_insert_id if there's a primary key.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8663 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index cf5211e514..6060c4ac1a 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -386,8 +386,8 @@ module ActiveRecord # 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. |