aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-09-24 08:37:24 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-09-24 08:38:02 -0600
commit3ae76f553f03b6233e7ec1520debac09bf13612e (patch)
tree72832d36814658381833da38ba6e3bfa91ee5375 /activerecord/test
parent44cff3045c5d98fb368e86949dd0973ee768c409 (diff)
parent871f45347778856feedf4b99c599e8acabc87ab6 (diff)
downloadrails-3ae76f553f03b6233e7ec1520debac09bf13612e.tar.gz
rails-3ae76f553f03b6233e7ec1520debac09bf13612e.tar.bz2
rails-3ae76f553f03b6233e7ec1520debac09bf13612e.zip
Merge pull request #21697 from gdeglin/fix_returning_disabled_default_values_bug
Fix a bug with returning_disabled when using the postgresql adapter
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
index 6e6850c4a9..e361521155 100644
--- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -123,6 +123,20 @@ module ActiveRecord
assert_equal expect.to_i, result.rows.first.first
end
+ def test_exec_insert_default_values_with_returning_disabled_and_no_sequence_name_given
+ connection = connection_without_insert_returning
+ result = connection.exec_insert("insert into postgresql_partitioned_table_parent DEFAULT VALUES", nil, [], 'id')
+ expect = connection.query('select max(id) from postgresql_partitioned_table_parent').first.first
+ assert_equal expect.to_i, result.rows.first.first
+ end
+
+ def test_exec_insert_default_values_quoted_schema_with_returning_disabled_and_no_sequence_name_given
+ connection = connection_without_insert_returning
+ result = connection.exec_insert('insert into "public"."postgresql_partitioned_table_parent" DEFAULT VALUES', nil, [], 'id')
+ expect = connection.query('select max(id) from postgresql_partitioned_table_parent').first.first
+ assert_equal expect.to_i, result.rows.first.first
+ end
+
def test_sql_for_insert_with_returning_disabled
connection = connection_without_insert_returning
result = connection.sql_for_insert('sql', nil, nil, nil, 'binds')