From eeb83fe9702f861608deab9d6b038f8a510ccc8d Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Thu, 1 Jun 2017 13:38:12 +0000 Subject: PostgreSQL 10 converts unknown OID 705 to text 25 - Rename test cases from `unknown` to `unrecognized` since unknown OID is one of possible unrecognized types by Rails - Use "select 'pg_catalog.pg_class'::regclass" whose OID is 2205, which will not be converted to recognized type in PostgreSQL 10. activerecord_unittest=# select oid, typname from pg_type where oid in (2205, 2277); oid | typname ------+---------- 2205 | regclass 2277 | anyarray (2 rows) Addresses #28868 --- .../cases/adapters/postgresql/postgresql_adapter_test.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index bfc763e1ef..76e0ad60fe 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -324,13 +324,13 @@ module ActiveRecord reset_connection end - def test_only_reload_type_map_once_for_every_unknown_type + def test_only_reload_type_map_once_for_every_unrecognized_type silence_warnings do assert_queries 2, ignore_none: true do - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" end assert_queries 1, ignore_none: true do - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" end assert_queries 2, ignore_none: true do @connection.select_all "SELECT NULL::anyarray" @@ -340,13 +340,13 @@ module ActiveRecord reset_connection end - def test_only_warn_on_first_encounter_of_unknown_oid + def test_only_warn_on_first_encounter_of_unrecognized_oid warning = capture(:stderr) { - @connection.select_all "SELECT NULL::anyelement" - @connection.select_all "SELECT NULL::anyelement" - @connection.select_all "SELECT NULL::anyelement" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" + @connection.select_all "select 'pg_catalog.pg_class'::regclass" } - assert_match(/\Aunknown OID \d+: failed to recognize type of 'anyelement'\. It will be treated as String\.\n\z/, warning) + assert_match(/\Aunknown OID \d+: failed to recognize type of 'regclass'\. It will be treated as String\.\n\z/, warning) ensure reset_connection end -- cgit v1.2.3