aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-08-18 03:05:33 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-08-18 04:51:45 +0900
commitc48630b1ce1d7cf7e6a30f1eafd28ccedcc256ed (patch)
tree6f3b961d565b5816d52d55742e4e7999c0b91ef1 /activerecord
parent6568cfd78c89fe70ac7304d03f8f4825fe0b7c72 (diff)
downloadrails-c48630b1ce1d7cf7e6a30f1eafd28ccedcc256ed.tar.gz
rails-c48630b1ce1d7cf7e6a30f1eafd28ccedcc256ed.tar.bz2
rails-c48630b1ce1d7cf7e6a30f1eafd28ccedcc256ed.zip
Remove unnecessary `test_sql_for_insert_with_returning_disabled`
Because `sql_for_insert` is only called in `use_insert_returning?` is true since #26002.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb5
-rw-r--r--activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb6
2 files changed, 2 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index 46aca2ab54..7414eba6c5 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -124,14 +124,13 @@ module ActiveRecord
pk = primary_key(table_ref) if table_ref
end
- pk = suppress_composite_primary_key(pk)
-
- if pk && use_insert_returning?
+ if pk = suppress_composite_primary_key(pk)
sql = "#{sql} RETURNING #{quote_column_name(pk)}"
end
super
end
+ protected :sql_for_insert
def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil)
if use_insert_returning? || pk == false
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
index 4b8d06be4b..e6af93a53e 100644
--- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -88,12 +88,6 @@ module ActiveRecord
assert_equal expect.to_i, result.rows.first.first
end
- def test_sql_for_insert_with_returning_disabled
- connection = connection_without_insert_returning
- sql, binds = connection.sql_for_insert("sql", nil, nil, nil, "binds")
- assert_equal ["sql", "binds"], [sql, binds]
- end
-
def test_serial_sequence
assert_equal "public.accounts_id_seq",
@connection.serial_sequence("accounts", "id")