Skip to content

Commit 32cd74a

Browse files
committed
Address PostgreSQLAdapterTest#test_disable_extension_without_schema error
This commit addresses this CI failure. https://buildkite.com/rails/rails/builds/109886#01912bdf-2f48-47e3-af85-cbc17d9824bd/1289-1300 ```ruby $ ARCONN=postgresql bin/test test/cases/adapters/postgresql/postgresql_adapter_test.rb test/cases/invertible_migration_test.rb -n "/^(?:ActiveRecord::InvertibleMigrationTest#(?:test_migrate_enable_and_disable_extension)|ActiveRecord::ConnectionAdapters::PostgreSQLAdapterTest#(?:test_disable_extension_without_schema))$/" --seed 45290 Using postgresql Run options: -n "/^(?:ActiveRecord::InvertibleMigrationTest#(?:test_migrate_enable_and_disable_extension)|ActiveRecord::ConnectionAdapters::PostgreSQLAdapterTest#(?:test_disable_extension_without_schema))$/" --seed 45290 .E Error: ActiveRecord::ConnectionAdapters::PostgreSQLAdapterTest#test_disable_extension_without_schema: ActiveRecord::StatementInvalid: PG::DuplicateObject: ERROR: extension "hstore" already exists lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec' lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `perform_query' lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute' lib/active_record/connection_adapters/abstract_adapter.rb:1004:in `block in with_raw_connection' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize' lib/active_record/connection_adapters/abstract_adapter.rb:976:in `with_raw_connection' lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:58:in `instrument' lib/active_record/connection_adapters/abstract_adapter.rb:1122:in `log' lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute' lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute' lib/active_record/connection_adapters/abstract/database_statements.rb:137:in `execute' lib/active_record/connection_adapters/abstract/query_cache.rb:26:in `execute' lib/active_record/connection_adapters/postgresql/database_statements.rb:40:in `execute' test/cases/adapters/postgresql/postgresql_adapter_test.rb:687:in `test_disable_extension_without_schema' bin/test test/cases/adapters/postgresql/postgresql_adapter_test.rb:686 Finished in 0.127199s, 15.7234 runs/s, 39.3085 assertions/s. 2 runs, 5 assertions, 0 failures, 1 errors, 0 skips $ ``` It also applies to the similar `test_disable_extension_with_schema` test that did not fail yet. Follow up rails#52452 rails#52451
1 parent cd912ad commit 32cd74a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def test_date_decoding_disabled
671671

672672
def test_disable_extension_with_schema
673673
@connection.execute("CREATE SCHEMA custom_schema")
674-
@connection.execute("CREATE EXTENSION hstore SCHEMA custom_schema")
674+
@connection.execute("CREATE EXTENSION IF NOT EXISTS hstore SCHEMA custom_schema")
675675
result = @connection.query("SELECT extname FROM pg_extension WHERE extnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'custom_schema')")
676676
assert_equal [["hstore"]], result.to_a
677677

@@ -684,7 +684,7 @@ def test_disable_extension_with_schema
684684
end
685685

686686
def test_disable_extension_without_schema
687-
@connection.execute("CREATE EXTENSION hstore")
687+
@connection.execute("CREATE EXTENSION IF NOT EXISTS hstore")
688688
result = @connection.query("SELECT extname FROM pg_extension")
689689
assert_includes result.to_a, ["hstore"]
690690

0 commit comments

Comments
 (0)